Microsoft.WinFX.targets Unknown build error Could not find assembly 'mscorlib'
- Dominant language
- C#
- Stars
- 7.7k
- Forks
- 1.3k
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 61
Description
* .NET Core Version: happens both with `3.1.401` and `5.0.100-preview.8.20417.9`
* Windows version: Win 10 (1909) 10.0.18363
* Does the bug reproduce also in WPF for .NET Framework 4.8?: for TFMs `netcoreapp3.1` and `net50`
* Is this bug related specifically to tooling in Visual Studio (e.g. XAML Designer, Code editing, etc...)? No, Visual Studio is not involved, only `dotnet build` from command line
This is essentially a duplicate of the _closed_ https://github.com/dotnet/wpf/issues/3183 ; the ticket was closed, although it was not resolved and I cannot re-open it. @ryalanms told me to reactivate when I see the issue again. Well, it has never been resolved for me. Sorry for the double-issue.
**Problem description:**
WPF core app doesn't build when adding a direct to an old .Net 2.0 WinCE-compatible 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 either (*SDK 3.1.401*)
```
C:\Program Files\dotnet\sdk\3.1.401\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.'
```
or (*SDK 5.0.100-preview.8.20417.9*)
```
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.'
```
**Expected behavior:**
`dotnet build` runs fine.
**Minimal repro:**
- `dotnet new wpf`
- TFM either `netcoreapp3.1` or `net50`
- Add a library reference to an old .Net Framework 2.0 WinCE library like so: ``
- `dotnet build`
Unfortunately I can't publish the proprietary dll here. It is built for .Net Framework 2 with WinCE compatibility.
@ryalanms [said that is should be fixed](https://github.com/dotnet/wpf/issues/3183#issuecomment-679340206) in `3.1.401`, but it is not fixed. He mentioned another version number `16.7.1` - unclear what for. Visual Studio is not involved and I've tested with different MSBuild versions too (the 5.0 preview comes with msbuild `16.8.0.xxx`).
Contributor guide
Assessment
This issue has not been assessed yet.