考虑 app.config 重新映射没有 app.config 映射的程序集

Consider app.config remapping of assembly with no app.config mapping

如何在不添加绑定到 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.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:

How can I determine where to fix this reference without adding a binding to the app.config?

您可以尝试将"MSBuild project build output verbosity"更改为“Detailed”或以上以查看详细错误日志。通过 工具 -> 选项...-> 项目和解决方案 -> 构建和 运行 来完成此操作。将 MSBuild 项目构建输出详细级别 设置为 Detailed 或更高级别。构建项目并检查输出中的错误日志 window。 ResolveAssemblyReferences 任务是 MSB3247 的起源任务,应该可以帮助您调试此特定问题。

然后转到旧版本的项目,删除引用,然后添加正确的引用。

我通过定位更高的 .Net Framework 版本解决了这个问题。从 4.7 切换到 4.7.2,警告消失了。在我从 EF6 切换到 EF.Core

后开始出现警告

真正的问题是 .csproj 文件中的引用在执行 nuget 更新时没有更新,因此在 app.config 中出现覆盖这些的警告。如果更新 .csproj,所有警告都会消失。

我在升级 Microsoft 身份包(通过 NuGet)时开始收到错误消息。 web.config 文件的 <runtime> 节点中的某些版本号未更新。我按照 Leo Liu-MSFT 的说明(上文)找到了此修复程序。