Error CS1703: Multiple assemblies with equivalent identity have been imported - Xamarin + VSTS

43,661

Solution 1

I have just solved the issue. Try removing the mscorlib.dll from the References Folder inside your solution itself. Refer to the below highlighted folder (Reference Folder). It seems that Xamarin will include the mscorlib.dll by default during its build. Hope it helps :)

enter image description here

Solution 2

Made the following change to .csproj, which did the trick:

   <PackageReference Include="System.Reflection.Emit">
      <Version>4.3.0</Version>
      <ExcludeAssets>All</ExcludeAssets>
      <IncludeAssets>none</IncludeAssets>
    </PackageReference>

Solution 3

I had an error installing a .net core nuget, which explicitly installs all the System.* libraries. It turned out that my Microsoft.Net.Compilers package needed upgrading, then this error went away.

Solution 4

I fixed this for myself by changing 7.1 back down to 6.0, and compilation started working again. The problem only appears on my compilation agent:

Compilation settings

Solution 5

I had a similar issue.

the following error was in the jenkins console output

Multiple assemblies with equivalent identity have been imported: 'C:\Program Files (x86)\Jenkins\jobs\...\lib\net461\System.ComponentModel.Annotations.dll' and 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.2\Facades\System.ComponentModel.Annotations.dll'. 
Remove one of the duplicate references.

I removed the duplicate reference in one of my projects and it worked.

Share:
43,661
Quality Catalyst
Author by

Quality Catalyst

Leading teams with my heart. Designing software with my soul. Developing software since 1988. Working on Microsoft platforms since 1994. Playing with the .NET platform since 2003. Floating through the Azure Cloud since 2015, and AWS since 2020. Software shall be simple and fast.

Updated on April 28, 2020

Comments

  • Quality Catalyst
    Quality Catalyst almost 4 years

    I upgraded to the latest Xamarin for Visual Studio 2015 (Community Edition), recompiled my projects, checked in a few small code changes and my VSTS build server fails with this error message:

    [error]CSC(0,0): Error CS1703: Multiple assemblies with equivalent identity have been imported: 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\mscorlib.dll' and 'C:\Windows\Microsoft.NET\Framework\v4.0.30319\mscorlib.dll'. Remove one of the duplicate references.

    Internet searches return nearly no details about this issue in general and no valuable information at all in the context of VSTS and Xamarin.

    The only code change that I consider to be relevant to the issue was done by Visual Studio in the project file:

    enter image description here

    I only develop for Android, am on Xamarin 4.2 and use the JDK 8 u101.

    Any idea how to solve this issue?