Frank Q.
Frank Q.

Reputation: 6582

Suppressing MSB3276: Found conflicts between different versions

Here is the scenario

A.dll references B.dll (2.0.0.0)

A.dll references C.dll and C.dll references B.dll (1.0.0.0)

Obviously, msbuild will invoke the warning below since B.dll versions conflict. Automatically it will pick the latest version since I denied creating app.config file automatically in csproj file.

Warning: MSB3276 - Found conflicts between different versions of the same dependent assembly. Please set the "AutoGenerateBindingRedirects"

And I do not want to redirect anything since neither one will work with each other versions.

Question:

How do I get rid of this warning or suppress it ?

Note: Both assemblies will be installed in GAC at the time of installation process so runtime references will resolve just fine. Sadly, there seems no way to indicate MSBuild to let go of this warning.

Upvotes: 4

Views: 1245

Answers (2)

Ritchie Carroll
Ritchie Carroll

Reputation: 46

As of Visual Studio 2017 / MSBuild 15, edit the project file and add the following to the Project\ProprtyGroup section:

  <PropertyGroup>
    <MSBuildWarningsAsMessages>MSB3276</MSBuildWarningsAsMessages>
  </PropertyGroup>

Works on my instance of Visual Studio 15.9.11

Ritchie

Upvotes: 1

Leo Liu
Leo Liu

Reputation: 76660

How do I get rid of this warning or suppress it ?

This is a very stubborn warning but it is a valid warning. You can try to edit your project file and add this property group and setting to disable the warning:

<PropertyGroup>
  <ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>None</ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>
</PropertyGroup>

Note: This setting also covers other warnings about mismatch assembly, etc. MSB3270.

Upvotes: 0

Related Questions