解决 MSB3247 - 发现同一依赖程序集的不同版本之间存在冲突

时间:2023-02-03
本文介绍了解决 MSB3247 - 发现同一依赖程序集的不同版本之间存在冲突的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

.NET 3.5 解决方案在使用 msbuild 编译时出现此警告.

A .NET 3.5 solution ended up with this warning when compiling with msbuild.

有时 NDepend 可能会有所帮助,但在这种情况下,它没有提供任何进一步的细节.像 Bob 我最终不得不求助于打开每个程序集ILDASM 直到我找到引用旧版本依赖程序集的那个.

Sometimes NDepend might help out but in this case it didn't give any further details. Like Bob I ended up having to resort to opening each assembly in ILDASM until I found the one that was referencing an older version of the dependant assembly.

我确实尝试使用 VS 2010 Beta 2 中的 MSBUILD(因为 Connect 文章指出这已在 CLR 的下一版本中修复),但也没有提供更多细节(可能在 Beta 2 后修复)

I did try using MSBUILD from VS 2010 Beta 2 (as the Connect article indicated this was fixed in the next version of the CLR) but that didn't provide any more detail either (maybe fixed post Beta 2)

有没有更好(更自动化)的方法?

Is there a better (more automated) approach?

推荐答案

将MSBuild 项目构建输出详细程度"更改为详细"或以上.为此,请按以下步骤操作:

Change the "MSBuild project build output verbosity" to "Detailed" or above. To do this, follow these steps:

  1. 打开选项对话框(工具 -> 选项...).
  2. 在左侧树中,选择 Projects and Solutions 节点,然后选择 Build and Run.
    • 注意:如果此节点未显示,请确保对话框底部的复选框显示所有设置已选中.
  1. Bring up the Options dialog (Tools -> Options...).
  2. 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.

在出现的工具/选项页面中,根据您的版本将 MSBuild 项目构建输出详细程度 级别设置为适当的设置:

In the tools/options page that appears, set the MSBuild project build output verbosity level to the appropriate setting depending on your version:

  • 诊断在 VS2012、VS2013 或 VS2015 上时(这些版本中的消息您应该使用详细",但这是完全错误的,您应该使用诊断")
  • 详解当你在 VS2010 上时
  • 普通在 VS2008 或更早版本中就足够了.
  • 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.

查看 MSBuild 消息.ResolveAssemblyReferences 任务是 MSB3247 的起源任务,应该可以帮助您调试此特定问题.

Check out the MSBuild messages. The ResolveAssemblyReferences task, which is the task from which MSB3247 originates, should help you debug this particular issue.

我的具体情况是对 SqlServerCe 的错误引用.见下文.我有两个项目引用了两个不同版本的 SqlServerCe.我去了旧版本的项目,删除了引用,然后添加了正确的引用.

My specific case was an incorrect reference to SqlServerCe. See below. I had two projects referencing two different versions of SqlServerCe. I went to the project with the older version, removed the reference, then added the correct reference.

Target ResolveAssemblyReferences:
    Consider app.config remapping of assembly "System.Data.SqlServerCe, ..." 
        from Version "3.5.1.0" [H:...DebugSystem.Data.SqlServerCe.dll] 
        to Version "9.0.242.0" [C:Program FilesMicrosoft Visual Studio 8Common7IDEPublicAssembliesSystem.Data.SqlServerCe.dll]
        to solve conflict and get rid of warning.
    C:WINDOWSMicrosoft.NETFrameworkv3.5Microsoft.Common.targets : 
        warning MSB3247: Found conflicts between different versions of the same dependent assembly.

<小时>

您不必打开每个程序集来确定引用程序集的版本.


You do not have to open each assembly to determine the versions of referenced assemblies.

  • 您可以检查每个参考的属性.
  • 打开项目属性并检查参考部分的版本.
  • 使用文本编辑器打开项目.
  • 使用 .Net Reflector.

这篇关于解决 MSB3247 - 发现同一依赖程序集的不同版本之间存在冲突的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

上一篇:运行 MSBuild 无法读取 SDKToolsPath 下一篇:MSBuild 的路径

相关文章

最新文章