当我清理并构建具有多个项目的解决方案时,输出窗口将报告构建成功。然而,当我查看错误列表窗口时,它向我显示了这样的警告:

发现同一依赖程序集的不同版本之间存在无法解决的冲突。当日志详细信息设置为detailed时,这些引用冲突将在生成日志中列出。C:\Program Files (x86)\MSBuild\12.0\bin\ Microsoft.Common.CurrentVersion.targets

当我双击此消息时,它将打开C:\Program Files (x86)\MSBuild\12.0\bin\ Microsoft.Common.CurrentVersion。目标文件,但我不明白任何东西在它。

我正在使用Visual Studio Express 2013的Web。

我如何找出什么是错误的,与哪个DLL,然后我如何使警告消失?


当前回答

请注意,我通过将AutoGenerateBindingRedirects放在csproj文件中的TargetFramework之后解决了这个问题:

<TargetFramework>net462</TargetFramework>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>

其他回答

我该如何让警告消失呢?

你可能需要重新安装或升级你的NuGet包来解决这个问题。

在visual studio中改变构建的冗长将有助于指向正确的方向。按照以下步骤更改VS中的详细信息

进入工具->选项菜单在VS 开放项目和解决方案->构建和运行 更改MSBuild项目构建输出详细信息的值。选择 分别是安静、最小、正常、详细和诊断

检查VS中的输出窗口(Ctrl+Alt+O),查看构建日志中的更改。

VS 2017, MVC项目

我不知道为什么,但对我来说,这个问题的解决方案是从控制器动作方法调用的模型方法签名中删除一个out参数。这是非常奇怪的行为,但这是我问题的解决方案。

I found that, sometimes, nuget packages will install (what I'm guessing are) .NET Core required components or other items that conflict with the already-installed framework. My solution there was to open the project (.csproj) file and remove those references. For example, System.IO, System.Threading and such, tend to be added when Microsoft.Bcl is included via some recently installed NuGet package. There's no reason for specific versions of those in my projects, so I remove the references and the project builds. Hope that helps.

您可以在项目文件中搜索“参考”并删除冲突。如果它们包含在系统中,那么去掉它们,构建应该可以工作。这可能不能回答这个问题的所有情况-我确保你知道什么对我有用:)

我注释掉的例子:

< !<参考Include=“系统。”Runtime,版本=2.6.9.0,Culture=neutral, PublicKeyToken= b03f5f7f3a, processorArchitecture=MSIL"> -> < !- <HintPath>$(解决方案)packages\Microsoft.Bcl.1.1.9\lib\net40\系统. runtpath > < !<Private>True</Private> -> < !</参考> ->

在将包从nuget切换到本地引用dll后,我遇到了这个问题。这个问题是app.config中的旧的运行时绑定。