Assembly manifest definition mismatch after .NET 4.5.1 to 4.6.1 Update

0

I just performed a some updates to an MVC web app. The app was running .NET Framework 4.5.1, and is now updated to 4.6.1. Also updated the NuGet packages.

Now I'm seeing a lot of warnings in the output window:

1>------ Publish started: Project: My Web App, Configuration: dev.example.com Any CPU ------
1>No way to resolve conflict between "System.Runtime, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" and "System.Runtime, Version=4.0.20.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a". Choosing "System.Runtime, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" arbitrarily.
1>No way to resolve conflict between "System.Runtime.Extensions, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" and "System.Runtime.Extensions, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a". Choosing "System.Runtime.Extensions, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" arbitrarily.
1>No way to resolve conflict between "System.Reflection, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" and "System.Reflection, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a". Choosing "System.Reflection, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" arbitrarily.
1>No way to resolve conflict between "System.Runtime.InteropServices, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" and "System.Runtime.InteropServices, Version=4.0.20.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a". Choosing "System.Runtime.InteropServices, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" arbitrarily.
1>Consider app.config remapping of assembly "System.Runtime.Serialization.Xml, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" from Version "4.0.10.0" [C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\Facades\System.Runtime.Serialization.Xml.dll] to Version "4.1.3.0" [C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Microsoft\Microsoft.NET.Build.Extensions\net461\lib\System.Runtime.Serialization.Xml.dll] to solve conflict and get rid of warning.
1>Consider app.config remapping of assembly "System.Globalization.Extensions, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" from Version "0.0.0.0" [] to Version "4.1.0.0" [C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Microsoft\Microsoft.NET.Build.Extensions\net461\lib\System.Globalization.Extensions.dll] to solve conflict and get rid of warning.

{
    Many more of "1>Consider app.config remapping of assembly ..." 
}

1>Transformed Web.config using C:\Users\Robert\Source\Repos\My Product Selector\My Web App\Web.my-dev.example.com.config into obj\my-dev.example.com\TransformWebConfig\transformed\Web.config.
1>Copying all files to temporary location below for package/publish:
1>obj\my-dev.example.com\AspnetCompileMerge\Source.
1>C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\aspnet_compiler.exe -v / -p "C:\Users\Robert\Source\Repos\My Product Selector\my Web App\obj\my-dev.example.com\AspnetCompileMerge\Source" -u -c "C:\Users\Robert\Source\Repos\My Product Selector\my Web App\obj\my-dev.example.com\AspnetCompileMerge\TempBuildDir" 
1>C:\Users\Robert\Source\Repos\My Product Selector\my Web App\obj\my-dev.example.com\AspnetCompileMerge\Source\web.config(117,0): Error ASPCONFIG: Could not load file or assembly 'System.Runtime, Version=4.3.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
1>
========== Build: 0 succeeded, 0 failed, 1 up-to-date, 0 skipped ==========
========== Publish: 0 succeeded, 1 failed, 0 skipped ==========

In the Error window I get:

Could not load file or assembly 'System.Runtime, Version=4.3.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)  GPS Web App C:\Users\Robert\Source\Repos\My Product Selector\My Web App\obj\my-dev.example.com\AspnetCompileMerge\Source\web.config 117 

I'm not sure where to go with this. I'm using VS Professional 2017. I've tried deleting everything in the /bin folder and rebuilding.

c#
asp.net
.net
visual-studio
asked on Stack Overflow Aug 12, 2018 by rwkiii

1 Answer

1

you need assembly binding redirection, and this can be done by vs automatically. https://docs.microsoft.com/en-us/dotnet/framework/configure-apps/how-to-enable-and-disable-automatic-binding-redirection

answered on Stack Overflow Aug 12, 2018 by zhimin

User contributions licensed under CC BY-SA 3.0