question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Microsoft.WinFX.targets Unknown build error Could not find assembly 'mscorlib'

See original GitHub issue
  • .NET Core Version: Version: 3.1.301, Commit: 7feb845744 Base Path: C:\Program Files\dotnet\sdk\3.1.301
    Host (useful for support): Version: 3.1.5, Commit: 65cd789777
  • Windows version: Win 10 (1909) 10.0.18363
  • Does the bug reproduce also in WPF for .NET Framework 4.8?: Not when creating a classic WPF full Framework project
  • Is this bug related specifically to tooling in Visual Studio (e.g. XAML Designer, Code editing, etc…)? no, dotnet build fails (without VS being involved)

Problem description: WPF core app doesn’t build when adding a direct <Reference .../> to an old .Net 2.0 framework dll. (Why would you do that? Expensive, proprietary dll from 3rd party, we can’t live without it, author has retired)

Actual behavior: dotnet build fails with

C:\Program Files\dotnet\sdk\3.1.301\Sdks\Microsoft.NET.Sdk.WindowsDesktop\targets\Microsoft.WinFX.targets(225,9):
error MC1000: Unknown build error, 'Could not find assembly 'mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=969db8053d3322ac'. Either explicitly load this assembly using a method such as LoadFromAssemblyPath() or use a MetadataAssemblyResolver that returns a valid assembly.' [D:\Downloads\DotnetWpfCoreProblem\DotnetWpfCoreProblem.csproj]

Expected behavior: It builds fine.

Minimal repro: Create a new WPF core project: dotnet new wpf which will target netcoreapp3.1 at the time of writing. Add a library reference to an old .Net Framework 2.0 WinCE library. Something like

<Reference Include="SomethingOld" HintPath="SomethingOld.dll" />

Try to build. Unfortunately I can’t publish the proprietary dll here. It is built for .Net Framework 2 with WinCE compatibility.

Related Issues I found similar topics where the build failed with the same error (mscorlib not found), but they seem to be resolved. https://github.com/dotnet/wpf/issues/1451 https://github.com/dotnet/wpf/issues/2274

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
DanFTRXcommented, Aug 6, 2020

@wldevries If you just updated Visual Studio you are more likely hitting this: https://github.com/dotnet/sdk/issues/12710

0reactions
nzaincommented, Sep 3, 2020

Switching the TargetFramework to net5.0 doesn’t make a difference. @ryalanms commented Please reactivate, if you see it again. but I cannot change the ticket status.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Microsoft.WinFX.targets Unknown build error Could not find ...
WinFX.targets Unknown build error Could not find assembly 'mscorlib' #3465 ... C:\Program Files\dotnet\sdk\3.1.401\Sdks\Microsoft.NET.
Read more >
WPF apps fail to compile after updating to
WinFX.targets(225,9): error MC1000: Unknown build error, 'Could not find assembly 'mscorlib, Version=2.0.5.0, Culture=neutral ...
Read more >
NETCore 3.1 - Error MC1000 Unknown build error, 'Could ...
When you target .netcoreapp31 AND net472, the Nuget packages do not seem to get pointed to the target frameworks correctly.
Read more >
Troubleshoot .NET Framework targeting errors
To resolve the error, make sure that your application targets a .NET version that's compatible with the version that's targeted by the projects ......
Read more >
VS: CLR project can't build because of changes in VS2022
A VS2022 CLR project generated by CMake shows an error message "could not find assembly 'mscorlib.dll'". Did some search and find this post:...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found