首页 > 解决方案 > .NET 4.5.1 到 4.6.1 更新后的程序集清单定义不匹配

问题描述

我刚刚对 MVC Web 应用程序进行了一些更新。该应用程序运行的是 .NET Framework 4.5.1,现在已更新到 4.6.1。还更新了 NuGet 包。

现在我在输出窗口中看到很多警告:

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 ==========

在错误窗口中,我得到:

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 

我不知道该去哪里。我正在使用 VS Professional 2017。我尝试删除 /bin 文件夹中的所有内容并重新构建。

标签: c#asp.net.netvisual-studio

解决方案



推荐阅读