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

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

问题描述

我目前正在开发一个.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禁用源 - code文件)?

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)?

推荐答案

该警告表示两个项目引用相同的组件(如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)。这是preferred的选择,因为所有code与依赖关系,他们与被编译的版本上运行。

  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.

添加一个绑定重定向。这将燮preSS的警告。但是,您的.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。我不知道这是否会燮preSS的警告。它将,就像上面的选项2,意味着所有的项目将使用.NET 3.5版的System.Windows.Forms的。

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.

下面是一个实用程序,以确定有问题的参考(S):

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

https://gist.github.com/1553265

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

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