. net 3.5解决方案在使用msbuild编译时出现此警告。
有时NDepend可能会有所帮助,但在这种情况下,它没有提供任何进一步的细节。像Bob一样,我最终不得不在ILDASM中打开每个程序集,直到找到引用依赖程序集的旧版本。
我确实尝试使用VS 2010 Beta 2的MSBUILD(连接文章指出这在CLR的下一个版本中得到了修复),但也没有提供更多的细节(可能是在Beta 2后修复的)。
有没有更好的(更自动化的)方法?
. net 3.5解决方案在使用msbuild编译时出现此警告。
有时NDepend可能会有所帮助,但在这种情况下,它没有提供任何进一步的细节。像Bob一样,我最终不得不在ILDASM中打开每个程序集,直到找到引用依赖程序集的旧版本。
我确实尝试使用VS 2010 Beta 2的MSBUILD(连接文章指出这在CLR的下一个版本中得到了修复),但也没有提供更多的细节(可能是在Beta 2后修复的)。
有没有更好的(更自动化的)方法?
当前回答
此警告产生于默认ASP。NET MVC 4测试版 在这里看到的
中,此警告的任何强制转换都可以通过手动编辑 .csproj文件。 修改……: Reference Include="System.Net.Http" 阅读......: Reference Include="System.Net. "Http, Version = 4.0.0.0 "
其他回答
有时候@AMissico的答案是不够的。在我的例子中,我在Output窗口中找不到错误,所以我决定创建一个日志文件并分析它,执行以下步骤:
将构建日志保存到一个文件…https://msdn.microsoft.com/en-us/library/ms171470.aspx msbuild MyProject的。proj /fl /flp:logfile=MyProjectOutput.log 查找文本:警告MS…或者具体的警告信息:(例如,第9293行)发现不同版本之间存在冲突…和冲突错误的完整细节将在此消息的上面(例如,第9277行)。
Visual Studio 2013
将“MSBuild项目构建输出详细信息”更改为“详细信息”或以上。要做到这一点,请遵循以下步骤:
Bring up the Options dialog (Tools -> Options...). In the left-hand tree, select the Projects and Solutions node, and then select Build and Run. Note: if this node doesn't show up, make sure that the checkbox at the bottom of the dialog Show all settings is checked. In the tools/options page that appears, set the MSBuild project build output verbosity level to the appropriate setting depending on your version: Diagnostics when on VS2012, VS2013 or VS2015 (the message in these versions says you should use "Detailed", but this is plain wrong, you should use "Diagnostics") Detailed when you're on VS2010 Normal will suffice in VS2008 or older. Build the project and look in the output window.
检查MSBuild消息。ResolveAssemblyReferences任务(MSB3247的起源任务)应该可以帮助您调试此特定问题。
我的具体情况是对SqlServerCe的不正确引用。见下文。我有两个项目引用了两个不同版本的SqlServerCe。我使用旧版本的项目,删除了引用,然后添加了正确的引用。
Target ResolveAssemblyReferences:
Consider app.config remapping of assembly "System.Data.SqlServerCe, ..."
from Version "3.5.1.0" [H:\...\Debug\System.Data.SqlServerCe.dll]
to Version "9.0.242.0" [C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\PublicAssemblies\System.Data.SqlServerCe.dll]
to solve conflict and get rid of warning.
C:\WINDOWS\Microsoft.NET\Framework\v3.5\Microsoft.Common.targets :
warning MSB3247: Found conflicts between different versions of the same dependent assembly.
您不必打开每个程序集来确定引用程序集的版本。
您可以检查每个引用的属性。 打开项目属性并检查References部分的版本。 使用文本编辑器打开项目。 使用. net Reflector。
正如这里提到的,您需要删除未使用的引用,警告就会消失。
Mike Hadlow发布了一个名为AsmSpy的小控制台应用程序,它很好地列出了每个程序集的引用:
Reference: System.Net.Http.Formatting
4.0.0.0 by Shared.MessageStack
4.0.0.0 by System.Web.Http
Reference: System.Net.Http
2.0.0.0 by Shared.MessageStack
2.0.0.0 by System.Net.Http.Formatting
4.0.0.0 by System.Net.Http.WebRequest
2.0.0.0 by System.Web.Http.Common
2.0.0.0 by System.Web.Http
2.0.0.0 by System.Web.Http.WebHost
与依赖MSBuild输出相比,这是获取警告MSB3247底部的更快方法。
此警告产生于默认ASP。NET MVC 4测试版 在这里看到的
中,此警告的任何强制转换都可以通过手动编辑 .csproj文件。 修改……: Reference Include="System.Net.Http" 阅读......: Reference Include="System.Net. "Http, Version = 4.0.0.0 "