You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Microsoft.WinFX.targets Unknown build error Could not find assembly 'mscorlib' #3183
.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
@fabiant3 Attached is everything that was generated so far. bin is empty (as expected) but hopefully you find what you're looking for in obj. If not, please explain how to get the required data.
I'm not sure how this relates to what I'm experiencing, but my WPF builds produce the exact same build error in the following scenario:
Empty Microsoft.NET.Sdk.WindowsDesktop project targeting net47. Reproduce by creating a NET Core WPF project and change the target to net47
PackageReference to CommonServiceLocator 1.3.0
This is a tiny repro from one of our products that depends on an older version of Prism that uses CommonServiceLocator. We updated all of our NET Framework projects to the new Microsoft.NET.Sdk project system, which might not have been smart in hindsight.
The latest dotnet SDK 5.0.100-preview.8.20417.9 comes with Microsoft (R) Build Engine version 16.8.0-preview-20414-02+a55ce4fbb, but the issue is unchanged: mscorlib, Version=2.0.0.0 is not found.
C:\Program Files\dotnet\sdk\5.0.100-preview.8.20417.9\Sdks\Microsoft.NET.Sdk.WindowsDesktop\targets\Microsoft.WinFX.targets(240,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.'
Activity
fabiant3 commentedon Jun 29, 2020
@nzain - could you provide an isolated repro? (just the metadata from the assembly/ildasm)
nzain commentedon Jun 29, 2020
Not sure what exactly that should be. Tomorrow, I'll add the project+output (if anything was generated) except for that proprietary lib.
nzain commentedon Jun 30, 2020
dotnet wpf issue 3183.zip
@fabiant3 Attached is everything that was generated so far.
binis empty (as expected) but hopefully you find what you're looking for inobj. If not, please explain how to get the required data.wldevries commentedon Aug 6, 2020
I'm not sure how this relates to what I'm experiencing, but my WPF builds produce the exact same build error in the following scenario:
This is a tiny repro from one of our products that depends on an older version of Prism that uses CommonServiceLocator. We updated all of our NET Framework projects to the new Microsoft.NET.Sdk project system, which might not have been smart in hindsight.
franchyd commentedon Aug 6, 2020
@wldevries If you just updated Visual Studio you are more likely hitting this: dotnet/sdk#12710
ryalanms commentedon Aug 24, 2020
This should be fixed in 16.7.1 and 3.1.401. Please reactivate if you see it again. Thanks!
nzain commentedon Aug 25, 2020
@ryalanms I guess you talk about
msbuild 16.7.1? I have dotnet SDK 3.1.401 installed (and the current 5.0 preview), but my msbuild is16.7.0-preview-20360-03+188921e2f. The github msbuild releases https://github.com/dotnet/msbuild/releases are outdated. Where can I get version 16.7.1?Just to clarify, the issue is not resolved for me right now.
nzain commentedon Sep 3, 2020
This issue is not fixed for me.
The latest dotnet SDK
5.0.100-preview.8.20417.9comes withMicrosoft (R) Build Engine version 16.8.0-preview-20414-02+a55ce4fbb, but the issue is unchanged:mscorlib, Version=2.0.0.0is not found.nzain commentedon Sep 3, 2020
Switching the
TargetFrameworkto net5.0 doesn't make a difference.@ryalanms commented Please reactivate, if you see it again. but I cannot change the ticket status.