警告:在同一个依赖程序集的不同版本之间发现冲突 [英] Warning: Found conflicts between different versions of the same dependent assembly

查看:2391
本文介绍了警告:在同一个依赖程序集的不同版本之间发现冲突的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在开发一个.NET应用程序,它由20个项目组成。其中一些项目使用.NET 3.5编译,其他一些仍然是.NET 2.0项目(到目前为止没有问题)。

I am currently developing a .NET application, which consists of 20 projects. Some of those projects are compiled using .NET 3.5, some others are still .NET 2.0 projects (so far no problem).

问题是,如果我包括一个外部组件我总是得到以下警告:

The problem is that if I include an external component I always get the following warning:

"Found conflicts between different versions of the same dependent assembly".

这个警告究竟是什么意思,也许有可能排除此警告(如使用#pragma这个警告意味着两个项目引用同一个程序集(例如<$ c $)(在源代码文件中禁用)

What exactly does this warning mean and is there maybe a possibility to exclude this warning (like using #pragma disable in the source- code files)?

推荐答案

c> System.Windows.Forms ),但是这两个项目需要不同的版本。您有几个选项:

This warning means that two projects reference the same assembly (e.g. System.Windows.Forms) but the two projects require different versions. You have a few options:


  1. 重新编译所有项目以使用相同的版本(例如移至.Net 3.5)。这是首选的选项,因为所有代码都使用它们编译的依赖关系的版本运行。

  1. Recompile all projects to use the same versions (e.g. move all to .Net 3.5). This is the preferred option because all code is running with the versions of dependencies they were compiled with.

添加绑定重定向。这将抑制警告。但是,.Net 2.0项目(在运行时)将绑定到.Net 3.5版本的依赖程序集,例如 System.Windows.Forms 。您可以通过在Visual Studio中双击错误快速添加绑定重定向。

Add a binding redirect. This will suppress the warning. However, your .Net 2.0 projects will (at runtime) be bound to the .Net 3.5 versions of dependent assemblies such as System.Windows.Forms. You can quickly add a binding redirect by double-clicking on error in Visual Studio.

使用 CopyLocal = true 。我不知道这是否会抑制警告。与上面的选项2一样,这意味着所有项目都将使用System.Windows.Forms的.Net 3.5版本。

Use CopyLocal=true. I'm not sure if this will suppress the warning. It will, like option 2 above, mean that all projects will use the .Net 3.5 version of System.Windows.Forms.

以下是识别违规参考的实用程序:

Here is a utility to identify the offending reference(s):

https://gist.github.com/1553265

这篇关于警告:在同一个依赖程序集的不同版本之间发现冲突的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆