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
Updating to 16.4 from 16.3.x causes build issues with WPF project file. #2274
When building a WPF project the following error is shown, this built fine in the last 16.3.x version that was released.
C:\Program Files\dotnet\sdk\3.1.100\Sdks\Microsoft.NET.Sdk.WindowsDesktop\targets\Microsoft.WinFX.targets(225,9): error MC1000: Unknown build error, 'Could not find assembly 'mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e'. Either explicitly load this assembly using a method such as LoadFromAssemblyPath() or use a MetadataAssemblyResolver that returns a valid assembly.'
Workaround:
Because only sdk 3.1.100 is installed after the update, I installed "dotnet-sdk-3.0.101-win-x64" and added a global.json with 3.0.101 to the project root. Now at least it compiles again (but with 3.0)
C:\Program Files\dotnet\sdk\3.1.100\Sdks\Microsoft.NET.Sdk.WindowsDesktop\targets\Microsoft.WinFX.targets(225,9): error MC1000: Unknown build error, 'Could not find assembly 'mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e'. Either explicitly load this assembly using a method such as LoadFromAssemblyPath() or use a MetadataAssemblyResolver that returns a valid assembly.'
Microsoft.WinFX.targets(225,9) is MarkupCompilePass1; When building a project for TargetFrameowrk=net472, it usually resolves mscorlib to a path like this:
Because only sdk 3.1.100 is installed after the update, I installed "dotnet-sdk-3.0.101-win-x64" and added a global.json with 3.0.101 to the project root
@livarcocc, @nguerrera, @chabiss, is it expected that 3.0.100 or 3.0.101 SDK vanishes when upgrading from Dev16.3.x --> Dev16.4?
Yes double-checked. When I change my target to 471 it compiles okay. Seems that the latest update has made that the minimum .NET version? Unfortunately, I can't target 471 and need 461. But this all worked under the last 16.3 update, it's only broke since updating to 16.4.
Yes, beginning with VS 16.3, VS will only "root" the one SDK it comes with. If VS installed an SDK and you upgrade to a VS that brings a newer SDK, it will remove the older SDK and add the newer one. There is ref counting so that if you install an SDK standalone, it will never be uninstalled by VS. VS gets one ref count and the standalone install gets another. If you have scenarios where you need multiple SDKs, you have to install the other ones standalone.
This came after a TON of feedback against leaving SDKs behind from VS upgrades.
I am advocating that the global.json default policy should allow roll forward to any newer version by default. You now have control over the roll forward, but the default is very restrictive and will only roll across the xx in A.B.Cxx if the matching version is not found.
Installing the 3.0.101 SDK and using global.json to force it, is a viable workaround that does not require rolling back all of VS, while we look at the issue and work on fixing it.
Reacted by Niek Jannink, Simon Jefferies, Vatsan Madhavan and zplan
I could reproduce it with an almost plain WPF project and a reference to Unit v4.0.1. I know, this is a very old version but for legacy reason I have to stick to this version. Before the VS 16.4 update it was no problem to build the project with this reference.
I had the same problem too. I fixed it, as mentioned above, by installing the .NET Core 3.0.101 SDK and adding a global.json file. However, why do I have to install a .NET Core SDK if my project isn't targetting .NET core at all?
Reacted by Simon Jefferies, Yimeng Wu and Matthew Jones
However, why do I have to install a .NET Core SDK if my project isn't targetting .NET core at all?
From my experience, that's because you are using the new "SDK-style" projects, which by definition use the .NET Core SDK/build system. When using the old ".NET Framework" project files, it will work fine.
.NET Core Runtime/SDK installers are also available separately, so you don't have to wait for a VS update if you don't want to. (Assuming the fix "being in 3.1.3" means its fixed in the SDK and not in VS)
Using Visual Studio 16.6, migrating WPF app to target .netcore3.1(.300). Cannot compile with error below:
Error MC1000 Unknown build error, 'Could not find assembly 'System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. Either explicitly load this assembly using a method such as LoadFromAssemblyPath() or use a MetadataAssemblyResolver that returns a valid assembly.' MyApp C:\Program Files\dotnet\sdk\3.1.300\Sdks\Microsoft.NET.Sdk.WindowsDesktop\targets\Microsoft.WinFX.targets 225
Is this the same issue? I seem to have most current .netcore (3.1.300) and VS16.6.0.
Same here. All WPF projects that reference DevExpress WPF libraries started failing to build after updating from 3.1.302 to 3.1.400:
C:\Program Files\dotnet\sdk\3.1.400\Sdks\Microsoft.NET.Sdk.WindowsDesktop\targets\Microsoft.WinFX.targets(225,9): error
MC1000: Unknown build error, 'Could not find assembly 'mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec
85d7bea7798e'. Either explicitly load this assembly using a method such as LoadFromAssemblyPath() or use a MetadataAsse
mblyResolver that returns a valid assembly.'
Activity
zplan commentedon Dec 4, 2019
Same issue here
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop"> <PropertyGroup> <TargetFramework>net472</TargetFramework> <UseWPF>true</UseWPF> <FileVersion>0.0.0.9999</FileVersion> <AssemblyVersion>0.0.0.9999</AssemblyVersion> </PropertyGroup>Workaround:
Because only sdk 3.1.100 is installed after the update, I installed "dotnet-sdk-3.0.101-win-x64" and added a global.json with 3.0.101 to the project root. Now at least it compiles again (but with 3.0)
simon-jefferies commentedon Dec 4, 2019
Yes i added the following global.json alongside my solution:
zplan commentedon Dec 4, 2019
But this is hopefully not the solution we have to accept...
vatsan-madhavan commentedon Dec 4, 2019
Microsoft.WinFX.targets(225,9)isMarkupCompilePass1; When building a project forTargetFrameowrk=net472, it usually resolvesmscorlibto a path like this:@olivegamestudio, @zplan, are you sure that .NET 4.6.1 and .NET 4.7.2 targeting packs are installed for you respectively?
vatsan-madhavan commentedon Dec 4, 2019
@livarcocc, @nguerrera, @chabiss, is it expected that 3.0.100 or 3.0.101 SDK vanishes when upgrading from Dev16.3.x --> Dev16.4?
simon-jefferies commentedon Dec 4, 2019
Yes double-checked. When I change my target to 471 it compiles okay. Seems that the latest update has made that the minimum .NET version? Unfortunately, I can't target 471 and need 461. But this all worked under the last 16.3 update, it's only broke since updating to 16.4.
nguerrera commentedon Dec 4, 2019
Yes, beginning with VS 16.3, VS will only "root" the one SDK it comes with. If VS installed an SDK and you upgrade to a VS that brings a newer SDK, it will remove the older SDK and add the newer one. There is ref counting so that if you install an SDK standalone, it will never be uninstalled by VS. VS gets one ref count and the standalone install gets another. If you have scenarios where you need multiple SDKs, you have to install the other ones standalone.
This came after a TON of feedback against leaving SDKs behind from VS upgrades.
I am advocating that the global.json default policy should allow roll forward to any newer version by default. You now have control over the roll forward, but the default is very restrictive and will only roll across the xx in A.B.Cxx if the matching version is not found.
cc @KathleenDollard
njannink commentedon Dec 4, 2019
Im having the same issue. This is currently blocking my work. I checked VS Installer and I have all required targetting packs and NetCore SDK 3.1
What is the proposed solution / workaround or is it possible to rollback a Visual Studio update?
nguerrera commentedon Dec 4, 2019
Installing the 3.0.101 SDK and using global.json to force it, is a viable workaround that does not require rolling back all of VS, while we look at the issue and work on fixing it.
nguerrera commentedon Dec 5, 2019
It would be very helpful if someone who is hitting this could provide a binlog with the failure.
zplan commentedon Dec 6, 2019
See the attached project.
I could reproduce it with an almost plain WPF project and a reference to Unit v4.0.1. I know, this is a very old version but for legacy reason I have to stick to this version. Before the VS 16.4 update it was no problem to build the project with this reference.
project.zip
pieterphilippaerts commentedon Dec 6, 2019
I had the same problem too. I fixed it, as mentioned above, by installing the .NET Core 3.0.101 SDK and adding a global.json file. However, why do I have to install a .NET Core SDK if my project isn't targetting .NET core at all?
siegfriedpammer commentedon Dec 13, 2019
@pieterphilippaerts
From my experience, that's because you are using the new "SDK-style" projects, which by definition use the .NET Core SDK/build system. When using the old ".NET Framework" project files, it will work fine.
44 remaining items
vatsan-madhavan commentedon Mar 20, 2020
@GeertvanHorrik as things stand, we are hoping for for 24/03/2020 (assuming that factors outside our control do not change this plan, of course 😄).
bclothier commentedon Mar 24, 2020
To clarify, as a part of Visual Studio 16.5 update?
weltkante commentedon Mar 24, 2020
.NET Core Runtime/SDK installers are also available separately, so you don't have to wait for a VS update if you don't want to. (Assuming the fix "being in 3.1.3" means its fixed in the SDK and not in VS)
vatsan-madhavan commentedon Mar 25, 2020
.NET Core 3.1.3 Release Notes
Download .NET Core 3.1
GeertvanHorrik commentedon Mar 25, 2020
I can confirm this has been fixed in 3.1.103, great work, thanks!
vatsan-madhavan commentedon Apr 14, 2020
Closing as this is now fixed.
Kerfluffel commentedon May 28, 2020
Using Visual Studio 16.6, migrating WPF app to target .netcore3.1(.300). Cannot compile with error below:
Error MC1000 Unknown build error, 'Could not find assembly 'System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. Either explicitly load this assembly using a method such as LoadFromAssemblyPath() or use a MetadataAssemblyResolver that returns a valid assembly.' MyApp C:\Program Files\dotnet\sdk\3.1.300\Sdks\Microsoft.NET.Sdk.WindowsDesktop\targets\Microsoft.WinFX.targets 225
Is this the same issue? I seem to have most current .netcore (3.1.300) and VS16.6.0.
Any suggestions how to get compiled?
nirzaf commentedon May 29, 2020
Still, No Fixes Microsoft is working on this issue slower than windows 10, Better you migrate to Java
weltkante commentedon May 29, 2020
@Kerfluffel no this is not the same issue, I suspect System.Web is not part of .NET Core (probably discontinued), so this error would be expected.
MatthewSteeples commentedon Aug 6, 2020
This looks to have regressed with 3.1.400 (16.7 release)
jnm2 commentedon Aug 7, 2020
Same here. All WPF projects that reference DevExpress WPF libraries started failing to build after updating from 3.1.302 to 3.1.400:
jnm2 commentedon Aug 10, 2020
An open issue where this is being tracked is #3312.