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.
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)?
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:
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.
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.
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 are a couple of ways to identify the offending reference(s):
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With