运行
msbuild Foo.sln /t:Rebuild /v:diag
(从
C:\Program Files (x86)\MSBuild\12.0\bin
)来从命令行构建您的解决方案并获得更多细节,然后找到记录警告的
.csproj.
检查它的引用以及使用不同版本的相同公共程序集的其他项目的引用。
编辑:您也可以在VS2013中直接设置构建详细信息。转到
工具
>
选项
菜单,然后转到
项目和解决方案
并将MSBuild详细程度设置为
诊断
。
编辑:由于我使用Resharper提示添加引用而不是使用“添加引用”对话框,所以我的情况警告是由于我添加引用而不带版本号,尽管可以选择v4和v12两个版本。
<Reference Include="Microsoft.Build, Version=12.0.0.0, ..." />
<Reference Include="Microsoft.Build.Framework" />
vs
<Reference Include="Microsoft.Build, Version=12.0.0.0, ..." />
<Reference Include="Microsoft.Build.Framework, Version=12.0.0.0, ..." />
在使用/v:diag
详细度的MSBuild日志中,看起来像下面这样。它提供了两个引用冲突的详细信息:
There was a conflict between
"Microsoft.Build.Framework, Version=4.0.0.0, ..." and
"Microsoft.Build.Framework, Version=12.0.0.0, ...". (TaskId:16)
"Microsoft.Build.Framework, Version=4.0.0.0, ..." was chosen because it was primary and
"Microsoft.Build.Framework, Version=12.0.0.0, ..." was not. (TaskId:16)
References which depend on "Microsoft.Build.Framework, Version=4.0.0.0, ..."
[C:\...\v4.5.1\Microsoft.Build.Framework.dll]. (TaskId:16)
C:\...\v4.5.1\Microsoft.Build.Framework.dll (TaskId:16)
Project file item includes which caused reference "C:\...\v4.5.1\Microsoft.Build.Framework.dll". (TaskId:16)
Microsoft.Build.Framework (TaskId:16)
References which depend on "Microsoft.Build.Framework, Version=12.0.0.0, ..."
[C:\...\v12.0\Microsoft.Build.Framework.dll]. (TaskId:16)
C:\...\v12.0\Microsoft.Build.dll (TaskId:16)
Project file item includes which caused reference "C:\...\v12.0\Microsoft.Build.dll". (TaskId:16)
Microsoft.Build, Version=12.0.0.0, ... (TaskId:16)
C:\...\v12.0\Microsoft.Build.Engine.dll (TaskId:16)
Project file item includes which caused reference "C:\...\v12.0\Microsoft.Build.Engine.dll". (TaskId:16)
Microsoft.Build, Version=12.0.0.0, ... (TaskId:16)
C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets(1697,5): warning MSB3277:
Found conflicts between different versions of the same dependent assembly that could not be resolved.
These reference conflicts are listed in the build log when log verbosity is set to detailed.
[C:\Users\Ilya.Kozhevnikov\Dropbox\BuildTree\BuildTree\BuildTree.csproj]
<PrivateAssets>
引起的。它将其他依赖项(我们称其为包X)的版本提升到了更高的版本。解决方案还有项目B,它将项目A作为引用。它看到包X的“低版本”(并选择该版本作为“主要”版本),因为私有资产请求的更高版本是...嗯,私有的-不可见的。现在到了构建的时候:PackageX.dll“低版本”被复制到输出,程序集projectA.dll被复制到输出... 等等! projectA.dll需要projekt X“更高版本”->无法解决的DLL地狱->构建失败。 - AnorZaken