Core: Error: Multiple assemblies with equivalent identity have been imported.

Created on 10 Apr 2017  路  12Comments  路  Source: dotnet/core

Hello I have a .NET 4.6.2 application referencing a DLL built on .NET Core 1.1 along with the System,Runtime.dll (4.1.0).

This seems to work without any issues on any computer with the two runtimes and a minimum of VS2015 installed. However, our build servers (Windows Server 2008 R2) are missing VS and are not building the project instead erroring with msbuild:

CSC : error CS1703: Multiple assemblies with equivalent identity have been imported: 'D:\BuildAgent\work\2973dc142048b0ec\packages\System.Runtime\lib\net462\System.Runtime.dll' and 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.2\Facades\System.Runtime.dll'. Remove one of the duplicate references. [D:\BuildAgent\work\2973dc142048b0ec\src\ProjectName\5elyknl3.tmp_proj]

I have installed VS2015 on one of the build servers just to verify, and the project started working and building. That being said is there anyway to fix this without having to go to each server and doing a full install of VS?

Most helpful comment

If it helps I do have the 4.6.2 SDK installed on those servers that do not compile the code.

Small discovery, copying the C:\Program Files (x86)\MSBuild\14.0 from the VS server to the non VS Server fixes the issue.

The non VS folder structure only has the Bin folder and ThirdPartyNotices where as the VS server has Bin, Imports, Microsoft.Common.Targets folders and Microsoft.Common, Microsoft.VisualStudioVersion.v14.Common project property files. The Bin folders also do not have the same amount of files.

All 12 comments

@weshaggard @ericstj does it sound familiar? If not, do you know where to route it?

It sounds like a issue with the msbuild filtering issue with the facades. I think that was fixed in a newer version of msbuild. @cdmihai @AndyGerlicher do you knows what is necessary to fix this?

AFAIK, the change we did was to allow Nuget based dependencies to win against the ones on disk: https://github.com/Microsoft/msbuild/pull/1520/

@ericstj or @dsplaisted should know the scenarios better for this.

If it helps I do have the 4.6.2 SDK installed on those servers that do not compile the code.

Small discovery, copying the C:\Program Files (x86)\MSBuild\14.0 from the VS server to the non VS Server fixes the issue.

The non VS folder structure only has the Bin folder and ThirdPartyNotices where as the VS server has Bin, Imports, Microsoft.Common.Targets folders and Microsoft.Common, Microsoft.VisualStudioVersion.v14.Common project property files. The Bin folders also do not have the same amount of files.

Is this still an issue?

Besides the work around I provided, yes this is still a problem

@terrajobst @weshaggard it looks like we still need to do something.

However, our build servers (Windows Server 2008 R2) are missing VS and are not building the project instead erroring with msbuild

Can you clarify which MSBuild you are using to do this?

@rjschmertz could you look into what version the build servers are using.

devbuild01 says 4.6.1590.0 when running .\MSBuild.exe -version from the latest version folder, \%windir%\Microsoft.NET\Framework\v4.0.30319

That's the MSBuild that's built into the desktop framework. I wouldn't recommend using that to build new projects, it's missing quite a lot of fixes, and will be substantially different than the MSBuild used by VS 2015. I could give you workarounds to make that old MSBuild work but that's just treating the symptoms and you could have more issues crop up in the future.

I believe the MSBuild team produces a standalone package for build servers so that you don't have to install all of VS: https://www.microsoft.com/en-us/download/details.aspx?id=48159. I'd reccomend using that to make your build machines closer to your dev environment (without installing all of VS, which I gather is undesirable).

That works, dev ops can roll that out to the build servers. Thank you Eric.

Was this page helpful?
0 / 5 - 0 ratings