dotnet/msbuild

MSB3243 warning is issued when project references two assemblies with same simple name, but with different strong names.

Open

#715 opened on Jun 21, 2016

View on GitHub
 (7 comments) (4 reactions) (0 assignees)C# (5,062 stars) (1,364 forks)batch import
backloghelp wantedtriaged

Description

If you have a project referencing two assemblies with different strong names, but same simple name:

Library, Version=2.0.0.0, Culture=neutral, PublicKeyToken=63dc4c2e4fb85cbb
Library, Version=1.0.0.0, Culture=neutral, PublicKeyToken=282ebfd59330c047

...MSBuild issues bogus warning MSB3243:

3>  There was a conflict between "Library, Version=2.0.0.0, Culture=neutral, PublicKeyToken=63dc4c2e4fb85cbb" and "Library, Version=1.0.0.0, Culture=neutral, PublicKeyToken=282ebfd59330c047".
3>C:\Program Files (x86)\MSBuild\15.0\bin\Microsoft.Common.CurrentVersion.targets(1820,5): warning MSB3243: No way to resolve conflict between "Library, Version=2.0.0.0, Culture=neutral, PublicKeyToken=63dc4c2e4fb85cbb" and "Library, Version=1.0.0.0, Culture=neutral, PublicKeyToken=282ebfd59330c047". Choosing "Library, Version=2.0.0.0, Culture=neutral, PublicKeyToken=63dc4c2e4fb85cbb" arbitrarily.

In reality, both assemblies are given different aliases in project file:

    <ProjectReference Include="..\Library1\Library1.csproj">
      <Project>{5effb800-ff22-4fdd-a0b0-bdc04cd2862e}</Project>
      <Name>Library1</Name>
      <Aliases>Library1</Aliases>
    </ProjectReference>
    <ProjectReference Include="..\Library2\Library2.csproj">
      <Project>{1a61b570-2451-4632-94fe-4a467e7c339c}</Project>
      <Name>Library2</Name>
      <Aliases>Library2</Aliases>
    </ProjectReference>

...and code uses extern alias directives to distinguish them:

extern alias Library1;
extern alias Library2;

Take repro solution compile it, and add both Library.dll's to the GAC. Repro.exe works just fine.

Contributor guide