.net 考虑没有 app.config 映射的程序集的 app.config 重新映射
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/45444112/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Consider app.config remapping of assembly with no app.config mapping
提问by Mike Flynn
How can I determine where to fix this reference without adding a binding to the app.config?
如何确定在不向 app.config 添加绑定的情况下修复此引用的位置?
Consider app.config remapping of assembly "System.Runtime.Serialization.Primitives, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" from Version "4.1.1.0" [] to Version "4.1.2.0" [F:\Production\packages\System.Runtime.Serialization.Primitives.4.3.0\lib\net46\System.Runtime.Serialization.Primitives.dll] to solve conflict and get rid of warning.
12>C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(1820,5): warning MSB3247: Found conflicts between different versions of the same dependent assembly. In Visual Studio, double-click this warning (or select it and press Enter) to fix the conflicts; otherwise, add the following binding redirects to the "runtime" node in the application configuration file:
Consider app.config remapping of assembly "System.Runtime.Serialization.Primitives, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" from Version "4.1.1.0" [] to Version "4.1.2.0" [F:\Production\packages\System.Runtime.Serialization.Primitives.4.3.0\lib\net46\System.Runtime.Serialization.Primitives.dll] to solve conflict and get rid of warning.
12>C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(1820,5): warning MSB3247: Found conflicts between different versions of the same dependent assembly. In Visual Studio, double-click this warning (or select it and press Enter) to fix the conflicts; otherwise, add the following binding redirects to the "runtime" node in the application configuration file:
回答by Leo Liu-MSFT
How can I determine where to fix this reference without adding a binding to the app.config?
如何确定在不向 app.config 添加绑定的情况下修复此引用的位置?
You can try to change the "MSBuild project build output verbosity" to "Detailed" or above to check the detail error log. To do this by Tools -> Options...->Projects and Solutions->Build and Run. Set the MSBuild project build output verbosity levelto Detailedor above. Build the project and checkout the error log in the output window. The ResolveAssemblyReferences task, which is the task from which MSB3247 originates, should help you debug this particular issue.
您可以尝试将“MSBuild 项目构建输出详细程度”更改为“详细”或以上以查看详细错误日志。为此,请使用Tools -> Options...->Projects and Solutions->Build and Run。将MSBuild 项目生成输出详细级别设置为“详细”或更高。构建项目并在输出窗口中检出错误日志。ResolveAssemblyReferences 任务是 MSB3247 的起源任务,应该可以帮助您调试这个特定问题。
Then go to the project with the older version, removed the reference, then added the correct reference.
然后转到旧版本的项目,删除引用,然后添加正确的引用。
回答by Matze
I solved this by targeting a higher .Net Framework version. Switched from 4.7 to 4.7.2 and the warnings went away. The warnings started after I switched from EF6 to EF.Core
我通过针对更高的 .Net Framework 版本解决了这个问题。从 4.7 切换到 4.7.2,警告消失了。我从 EF6 切换到 EF.Core 后开始出现警告
回答by balint
The real problem is that the References in the .csproj file are not updated when doing a nuget update, hence the warning to override these in the app.config. If you update the .csproj, all warnings go away.
真正的问题是 .csproj 文件中的引用在执行 nuget 更新时没有更新,因此警告在 app.config 中覆盖这些。如果您更新 .csproj,所有警告都会消失。
回答by Bill Matsoukas
I began getting the error when I upgraded the Microsoft Identity packages (via NuGet). Some of the version numbers were not updated in the <runtime>node of the web.config file. I found this fix by following Leo Liu-MSFT's instructions (above).
当我升级 Microsoft Identity 包(通过 NuGet)时,我开始收到错误消息。某些版本号未在<runtime>web.config 文件的节点中更新。我按照 Leo Liu-MSFT 的说明(以上)找到了此修复程序。


