4

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.

Frank Q.
  • 6,001
  • 11
  • 47
  • 62
  • 1
    MSBuild 15 / VS 2017 allows to build using `/nowarn:MSB3276`, not aware of any support for <15.. – Martin Ullrich Oct 02 '17 at 19:05
  • Is there a way to control this from csproj file instead for VS2017 ? – Frank Q. Oct 03 '17 at 03:29
  • Possible duplicate of [Warning: Found conflicts between different versions of the same dependent assembly](https://stackoverflow.com/questions/17806/warning-found-conflicts-between-different-versions-of-the-same-dependent-assemb) – Wai Ha Lee Apr 25 '19 at 11:47

2 Answers2

1

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

0

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.

Leo Liu
  • 71,098
  • 10
  • 114
  • 135