Bug 57849 - Getting "CSC : error CS1703: Multiple assemblies with equivalent identity have been imported" errors when installing nuget dependencies
Summary: Getting "CSC : error CS1703: Multiple assemblies with equivalent identity hav...
Status: VERIFIED FIXED
Alias: None
Product: Android
Classification: Xamarin
Component: MSBuild ()
Version: unspecified
Hardware: PC Mac OS
: High critical
Target Milestone: 15.5
Assignee: dean.ellis
URL:
Depends on:
Blocks:
 
Reported: 2017-06-28 22:12 UTC by James Moore
Modified: 2018-04-04 18:06 UTC (History)
9 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
VERIFIED FIXED

Description James Moore 2017-06-28 22:12:54 UTC
https://github.com/banshee/rxBugReportSampleCode.git has a project that can repro this problem.  

Build instructions in README.md.

Commit 8b82c42df8dd6574f27eeffc552591ce31a4cedf repros the problem; commit c78c2e053c63f91aa526652fde63e7bcfc99cc0f has a workaround.

It looks like the xamarin build is including files from the Facades directory (/Library/Frameworks/Mono.framework/External/xbuild-frameworks/MonoAndroid/v1.0/Facades/System.Xml.XDocument.dll for example), even though those are already in the build because they're nuget dependencies.

Error output:
Build started 6/28/2017 3:03:59 PM.
[91mCSC : error CS1703: Multiple assemblies with equivalent identity have been imported: '/Users/james/Projects/TestReactive/packages/System.Xml.XDocument/lib/netstandard1.3/System.Xml.XDocument.dll' and '/Library/Frameworks/Mono.framework/External/xbuild-frameworks/MonoAndroid/v1.0/Facades/System.Xml.XDocument.dll'. Remove one of the duplicate references. [/Users/james/Projects/TestReactive/TestReactive/TestReactive.csproj]
[39;49m[91mCSC : error CS1703: Multiple assemblies with equivalent identity have been imported: '/Users/james/Projects/TestReactive/packages/System.Threading/lib/netstandard1.3/System.Threading.dll' and '/Library/Frameworks/Mono.framework/External/xbuild-frameworks/MonoAndroid/v1.0/Facades/System.Threading.dll'. Remove one of the duplicate references. [/Users/james/Projects/TestReactive/TestReactive/TestReactive.csproj]
[39;49m[91mCSC : error CS1703: Multiple assemblies with equivalent identity have been imported: '/Users/james/Projects/TestReactive/packages/System.Runtime.Numerics/lib/netstandard1.3/System.Runtime.Numerics.dll' and '/Library/Frameworks/Mono.framework/External/xbuild-frameworks/MonoAndroid/v1.0/Facades/System.Runtime.Numerics.dll'. Remove one of the duplicate references. [/Users/james/Projects/TestReactive/TestReactive/TestReactive.csproj]
[39;49m[91mCSC : error CS1703: Multiple assemblies with equivalent identity have been imported: '/Users/james/Projects/TestReactive/packages/System.Runtime.InteropServices.WindowsRuntime/lib/netstandard1.3/System.Runtime.InteropServices.WindowsRuntime.dll' and '/Library/Frameworks/Mono.framework/External/xbuild-frameworks/MonoAndroid/v1.0/Facades/System.Runtime.InteropServices.WindowsRuntime.dll'. Remove one of the duplicate references. [/Users/james/Projects/TestReactive/TestReactive/TestReactive.csproj]
[39;49m[91mCSC : error CS1703: Multiple assemblies with equivalent identity have been imported: '/Users/james/Projects/TestReactive/packages/System.Reflection.Emit.Lightweight/lib/netstandard1.3/System.Reflection.Emit.Lightweight.dll' and '/Library/Frameworks/Mono.framework/External/xbuild-frameworks/MonoAndroid/v1.0/Facades/System.Reflection.Emit.Lightweight.dll'. Remove one of the duplicate references. [/Users/james/Projects/TestReactive/TestReactive/TestReactive.csproj]
[39;49m[91mCSC : error CS1703: Multiple assemblies with equivalent identity have been imported: '/Users/james/Projects/TestReactive/packages/System.Reflection.Emit.ILGeneration/lib/netstandard1.3/System.Reflection.Emit.ILGeneration.dll' and '/Library/Frameworks/Mono.framework/External/xbuild-frameworks/MonoAndroid/v1.0/Facades/System.Reflection.Emit.ILGeneration.dll'. Remove one of the duplicate references. [/Users/james/Projects/TestReactive/TestReactive/TestReactive.csproj]
[39;49m[91mCSC : error CS1703: Multiple assemblies with equivalent identity have been imported: '/Users/james/Projects/TestReactive/packages/System.Reflection.Emit/lib/netstandard1.3/System.Reflection.Emit.dll' and '/Library/Frameworks/Mono.framework/External/xbuild-frameworks/MonoAndroid/v1.0/Facades/System.Reflection.Emit.dll'. Remove one of the duplicate references. [/Users/james/Projects/TestReactive/TestReactive/TestReactive.csproj]
[39;49m[91mCSC : error CS1703: Multiple assemblies with equivalent identity have been imported: '/Users/james/Projects/TestReactive/packages/System.ObjectModel/lib/netstandard1.3/System.ObjectModel.dll' and '/Library/Frameworks/Mono.framework/External/xbuild-frameworks/MonoAndroid/v1.0/Facades/System.ObjectModel.dll'. Remove one of the duplicate references. [/Users/james/Projects/TestReactive/TestReactive/TestReactive.csproj]
[39;49m[91mCSC : error CS1703: Multiple assemblies with equivalent identity have been imported: '/Users/james/Projects/TestReactive/packages/System.Linq.Queryable/lib/netstandard1.3/System.Linq.Queryable.dll' and '/Library/Frameworks/Mono.framework/External/xbuild-frameworks/MonoAndroid/v1.0/Facades/System.Linq.Queryable.dll'. Remove one of the duplicate references. [/Users/james/Projects/TestReactive/TestReactive/TestReactive.csproj]
[39;49m[91mCSC : error CS1703: Multiple assemblies with equivalent identity have been imported: '/Users/james/Projects/TestReactive/packages/System.Dynamic.Runtime/lib/netstandard1.3/System.Dynamic.Runtime.dll' and '/Library/Frameworks/Mono.framework/External/xbuild-frameworks/MonoAndroid/v1.0/Facades/System.Dynamic.Runtime.dll'. Remove one of the duplicate references. [/Users/james/Projects/TestReactive/TestReactive/TestReactive.csproj]
[39;49m[91mCSC : error CS1703: Multiple assemblies with equivalent identity have been imported: '/Users/james/Projects/TestReactive/packages/System.Diagnostics.Contracts/lib/netstandard1.0/System.Diagnostics.Contracts.dll' and '/Library/Frameworks/Mono.framework/External/xbuild-frameworks/MonoAndroid/v1.0/Facades/System.Diagnostics.Contracts.dll'. Remove one of the duplicate references. [/Users/james/Projects/TestReactive/TestReactive/TestReactive.csproj]
[39;49m[91mCSC : error CS1703: Multiple assemblies with equivalent identity have been imported: '/Users/james/Projects/TestReactive/packages/System.ComponentModel/lib/netstandard1.3/System.ComponentModel.dll' and '/Library/Frameworks/Mono.framework/External/xbuild-frameworks/MonoAndroid/v1.0/Facades/System.ComponentModel.dll'. Remove one of the duplicate references. [/Users/james/Projects/TestReactive/TestReactive/TestReactive.csproj]
[39;49m[91mCSC : error CS1703: Multiple assemblies with equivalent identity have been imported: '/Users/james/Projects/TestReactive/packages/System.Collections.Concurrent/lib/netstandard1.3/System.Collections.Concurrent.dll' and '/Library/Frameworks/Mono.framework/External/xbuild-frameworks/MonoAndroid/v1.0/Facades/System.Collections.Concurrent.dll'. Remove one of the duplicate references. [/Users/james/Projects/TestReactive/TestReactive/TestReactive.csproj]
[39;49m[96mDone Building Project "/Users/james/Projects/TestReactive/TestReactive/TestReactive.csproj" (default targets) -- FAILED.
[39;49m[96mDone Building Project "/Users/james/Projects/TestReactive/TestReactive.sln" (default targets) -- FAILED.
[39;49m
Build FAILED.
[39;49m[93m
"/Users/james/Projects/TestReactive/TestReactive.sln" (default target) (1) ->
"/Users/james/Projects/TestReactive/TestReactive/TestReactive.csproj" (default target) (2) ->
(_CheckForContent target) -> 
  /Users/james/Projects/TestReactive/packages/Microsoft.DiaSymReader.Native/build/../runtimes/win/native/Microsoft.DiaSymReader.Native.x86.dll : warning XA0101: @(Content) build action is not supported [/Users/james/Projects/TestReactive/TestReactive/TestReactive.csproj]
  /Users/james/Projects/TestReactive/packages/Microsoft.DiaSymReader.Native/build/../runtimes/win/native/Microsoft.DiaSymReader.Native.amd64.dll : warning XA0101: @(Content) build action is not supported [/Users/james/Projects/TestReactive/TestReactive/TestReactive.csproj]
  /Users/james/Projects/TestReactive/packages/Microsoft.DiaSymReader.Native/build/../runtimes/win/native/Microsoft.DiaSymReader.Native.arm.dll : warning XA0101: @(Content) build action is not supported [/Users/james/Projects/TestReactive/TestReactive/TestReactive.csproj]


"/Users/james/Projects/TestReactive/TestReactive.sln" (default target) (1) ->
"/Users/james/Projects/TestReactive/TestReactive/TestReactive.csproj" (default target) (2) ->
(ResolveAssemblyReferences target) -> 
  /Library/Frameworks/Mono.framework/Versions/5.2.0/lib/mono/msbuild/15.0/bin/Microsoft.Common.CurrentVersion.targets(1980,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "Xamarin.Android.Support.v4". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. [/Users/james/Projects/TestReactive/TestReactive/TestReactive.csproj]
  /Library/Frameworks/Mono.framework/Versions/5.2.0/lib/mono/msbuild/15.0/bin/Microsoft.Common.CurrentVersion.targets(1980,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "Xamarin.Android.Support.v7.AppCompat". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. [/Users/james/Projects/TestReactive/TestReactive/TestReactive.csproj]
  /Library/Frameworks/Mono.framework/Versions/5.2.0/lib/mono/msbuild/15.0/bin/Microsoft.Common.CurrentVersion.targets(1980,5): warning MSB3277: Found conflicts between different versions of the same dependent assembly that could not be resolved.  These reference conflicts are listed in the build log when log verbosity is set to detailed. [/Users/james/Projects/TestReactive/TestReactive/TestReactive.csproj]

[91m
"/Users/james/Projects/TestReactive/TestReactive.sln" (default target) (1) ->
"/Users/james/Projects/TestReactive/TestReactive/TestReactive.csproj" (default target) (2) ->
(CoreCompile target) -> 
  CSC : error CS1703: Multiple assemblies with equivalent identity have been imported: '/Users/james/Projects/TestReactive/packages/System.Xml.XDocument/lib/netstandard1.3/System.Xml.XDocument.dll' and '/Library/Frameworks/Mono.framework/External/xbuild-frameworks/MonoAndroid/v1.0/Facades/System.Xml.XDocument.dll'. Remove one of the duplicate references. [/Users/james/Projects/TestReactive/TestReactive/TestReactive.csproj]
  CSC : error CS1703: Multiple assemblies with equivalent identity have been imported: '/Users/james/Projects/TestReactive/packages/System.Threading/lib/netstandard1.3/System.Threading.dll' and '/Library/Frameworks/Mono.framework/External/xbuild-frameworks/MonoAndroid/v1.0/Facades/System.Threading.dll'. Remove one of the duplicate references. [/Users/james/Projects/TestReactive/TestReactive/TestReactive.csproj]
  CSC : error CS1703: Multiple assemblies with equivalent identity have been imported: '/Users/james/Projects/TestReactive/packages/System.Runtime.Numerics/lib/netstandard1.3/System.Runtime.Numerics.dll' and '/Library/Frameworks/Mono.framework/External/xbuild-frameworks/MonoAndroid/v1.0/Facades/System.Runtime.Numerics.dll'. Remove one of the duplicate references. [/Users/james/Projects/TestReactive/TestReactive/TestReactive.csproj]
  CSC : error CS1703: Multiple assemblies with equivalent identity have been imported: '/Users/james/Projects/TestReactive/packages/System.Runtime.InteropServices.WindowsRuntime/lib/netstandard1.3/System.Runtime.InteropServices.WindowsRuntime.dll' and '/Library/Frameworks/Mono.framework/External/xbuild-frameworks/MonoAndroid/v1.0/Facades/System.Runtime.InteropServices.WindowsRuntime.dll'. Remove one of the duplicate references. [/Users/james/Projects/TestReactive/TestReactive/TestReactive.csproj]
  CSC : error CS1703: Multiple assemblies with equivalent identity have been imported: '/Users/james/Projects/TestReactive/packages/System.Reflection.Emit.Lightweight/lib/netstandard1.3/System.Reflection.Emit.Lightweight.dll' and '/Library/Frameworks/Mono.framework/External/xbuild-frameworks/MonoAndroid/v1.0/Facades/System.Reflection.Emit.Lightweight.dll'. Remove one of the duplicate references. [/Users/james/Projects/TestReactive/TestReactive/TestReactive.csproj]
  CSC : error CS1703: Multiple assemblies with equivalent identity have been imported: '/Users/james/Projects/TestReactive/packages/System.Reflection.Emit.ILGeneration/lib/netstandard1.3/System.Reflection.Emit.ILGeneration.dll' and '/Library/Frameworks/Mono.framework/External/xbuild-frameworks/MonoAndroid/v1.0/Facades/System.Reflection.Emit.ILGeneration.dll'. Remove one of the duplicate references. [/Users/james/Projects/TestReactive/TestReactive/TestReactive.csproj]
  CSC : error CS1703: Multiple assemblies with equivalent identity have been imported: '/Users/james/Projects/TestReactive/packages/System.Reflection.Emit/lib/netstandard1.3/System.Reflection.Emit.dll' and '/Library/Frameworks/Mono.framework/External/xbuild-frameworks/MonoAndroid/v1.0/Facades/System.Reflection.Emit.dll'. Remove one of the duplicate references. [/Users/james/Projects/TestReactive/TestReactive/TestReactive.csproj]
  CSC : error CS1703: Multiple assemblies with equivalent identity have been imported: '/Users/james/Projects/TestReactive/packages/System.ObjectModel/lib/netstandard1.3/System.ObjectModel.dll' and '/Library/Frameworks/Mono.framework/External/xbuild-frameworks/MonoAndroid/v1.0/Facades/System.ObjectModel.dll'. Remove one of the duplicate references. [/Users/james/Projects/TestReactive/TestReactive/TestReactive.csproj]
  CSC : error CS1703: Multiple assemblies with equivalent identity have been imported: '/Users/james/Projects/TestReactive/packages/System.Linq.Queryable/lib/netstandard1.3/System.Linq.Queryable.dll' and '/Library/Frameworks/Mono.framework/External/xbuild-frameworks/MonoAndroid/v1.0/Facades/System.Linq.Queryable.dll'. Remove one of the duplicate references. [/Users/james/Projects/TestReactive/TestReactive/TestReactive.csproj]
  CSC : error CS1703: Multiple assemblies with equivalent identity have been imported: '/Users/james/Projects/TestReactive/packages/System.Dynamic.Runtime/lib/netstandard1.3/System.Dynamic.Runtime.dll' and '/Library/Frameworks/Mono.framework/External/xbuild-frameworks/MonoAndroid/v1.0/Facades/System.Dynamic.Runtime.dll'. Remove one of the duplicate references. [/Users/james/Projects/TestReactive/TestReactive/TestReactive.csproj]
  CSC : error CS1703: Multiple assemblies with equivalent identity have been imported: '/Users/james/Projects/TestReactive/packages/System.Diagnostics.Contracts/lib/netstandard1.0/System.Diagnostics.Contracts.dll' and '/Library/Frameworks/Mono.framework/External/xbuild-frameworks/MonoAndroid/v1.0/Facades/System.Diagnostics.Contracts.dll'. Remove one of the duplicate references. [/Users/james/Projects/TestReactive/TestReactive/TestReactive.csproj]
  CSC : error CS1703: Multiple assemblies with equivalent identity have been imported: '/Users/james/Projects/TestReactive/packages/System.ComponentModel/lib/netstandard1.3/System.ComponentModel.dll' and '/Library/Frameworks/Mono.framework/External/xbuild-frameworks/MonoAndroid/v1.0/Facades/System.ComponentModel.dll'. Remove one of the duplicate references. [/Users/james/Projects/TestReactive/TestReactive/TestReactive.csproj]
  CSC : error CS1703: Multiple assemblies with equivalent identity have been imported: '/Users/james/Projects/TestReactive/packages/System.Collections.Concurrent/lib/netstandard1.3/System.Collections.Concurrent.dll' and '/Library/Frameworks/Mono.framework/External/xbuild-frameworks/MonoAndroid/v1.0/Facades/System.Collections.Concurrent.dll'. Remove one of the duplicate references. [/Users/james/Projects/TestReactive/TestReactive/TestReactive.csproj]

[39;49m[93m    6 Warning(s)
[39;49m[91m    13 Error(s)
[39;49m
Time Elapsed 00:00:06.03
[?1l>[39;49m
Script done on Wed Jun 28 15:04:05 2017
Comment 1 James Moore 2017-06-28 22:13:20 UTC
=== Visual Studio Professional 2017 for Mac (Preview) ===

Version 7.1 Preview (7.1 build 583)
Installation UUID: 54529aae-a4b8-4338-92ef-3daa15673f67
Runtime:
	Mono 5.2.0.104 (2017-04/4a0006f) (64-bit)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 502000104

=== NuGet ===

Version: 4.0.0.2323

=== .NET Core ===

Runtime: /usr/local/share/dotnet/dotnet
SDK: /usr/local/share/dotnet/sdk/1.0.0-preview2-003121/Sdks
MSBuild SDKs: /Library/Frameworks/Mono.framework/Versions/5.2.0/lib/mono/msbuild/15.0/bin/Sdks

=== Xamarin.Profiler ===

Version: 1.5.4
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

=== Apple Developer Tools ===

Xcode 8.3.3 (12175.1)
Build 8E3004b

=== Xamarin.Android ===

Version: 7.3.1.2 (Visual Studio Professional)
Android SDK: /Users/james/Library/Developer/Xamarin/android-sdk-mac_x86
	Supported Android versions:
		5.0 (API level 21)
		7.1 (API level 25)

SDK Tools Version: 26.0.2
SDK Platform Tools Version: 26.0.0
SDK Build Tools Version: 26.0.0 rc2

Java SDK: /Library/Java/JavaVirtualMachines/jdk1.8.0_77.jdk/Contents/Home
java version "1.8.0_77"
Java(TM) SE Runtime Environment (build 1.8.0_77-b03)
Java HotSpot(TM) 64-Bit Server VM (build 25.77-b03, mixed mode)

Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL

=== Xamarin.iOS ===

Version: 10.11.0.126 (Visual Studio Professional)
Hash: 7571635e
Branch: master
Build date: 2017-05-09 16:04:54-0400

=== Xamarin.Mac ===

Version: 3.5.0.126 (Visual Studio Professional)

=== Xamarin Inspector ===

Version: 1.3.0-alpha2
Hash: fa030e0
Branch: master
Build date: Thu, 01 Jun 2017 20:55:26 GMT
Client compatibility: 1

=== Build Information ===

Release ID: 701000583
Git revision: 445a7f09feca58babb966e0c66a6b299d0bd450c
Build date: 2017-05-12 16:05:38-04
Xamarin addins: f9b72ca5f6ca5d9476d8f58353ada2afd56c549b
Build lane: monodevelop-lion-d15-3-preview

=== Operating System ===

Mac OS X 10.12.5
Darwin 16.6.0 Darwin Kernel Version 16.6.0
    Fri Apr 14 16:21:16 PDT 2017
    root:xnu-3789.60.24~6/RELEASE_X86_64 x86_64

=== Enabled user installed addins ===

Macaque Tips 0.1.2
Comment 2 Tejas 2017-09-15 08:17:22 UTC
Guys, this is a serious issue.

All my Xamarin Android builds are breaking (5 projects), and I have to go and modify the .csproj file in each one.

What's worse is we use Paket to manage dependencies, and after *any* change to any of our packages, I have to keep mucking around with the csproj file each time.

Such a basic thing broken, please fix.
Comment 3 Jonathan Pryor 2017-09-15 15:32:08 UTC
Repro instructions:

> git clone https://github.com/banshee/rxBugReportSampleCode.git
> cd rxBugReportSampleCode
> git checkout 8b82c42df8dd6574f27eeffc552591ce31a4cedf
> mono .paket/paket.bootstrapper.exe
> mono .paket/paket.exe install
> msbuild /v:diag > b.txt
Comment 4 dean.ellis 2017-09-15 20:08:19 UTC
PR is up on https://github.com/xamarin/xamarin-android/pull/867
Comment 5 dean.ellis 2017-09-19 09:42:11 UTC
Fixed in Xamarin-android/master/17cda3fb
Comment 8 oscar.ssentoogo 2018-02-06 01:38:55 UTC
Hello Xamarin team,

Take a look at this question  I don't think this issue is fully resolved (or perhaps it's a new issue).

Please advise whether to log a new bug.

https://forums.xamarin.com/discussion/comment/318818#Comment_318818
Comment 9 Mike Miller 2018-04-04 18:06:03 UTC
I'm encountering this with Android - but only when building on AppCenter.  It deploys just fine with Visual Studio (15.6.4) to simulators and to a physical device.  




"/Users/vsts/agent/2.131.0/work/1/s/Champ.Android/Champ.Android.csproj" (PackageForAndroid target) (1) ->
(CoreCompile target) -> 
  CSC : error CS1703: Multiple assemblies with equivalent identity have been imported: '/Library/Frameworks/Mono.framework/External/xbuild-frameworks/MonoAndroid/v1.0/mscorlib.dll' and '/Library/Frameworks/Mono.framework/Versions/5.4.1/lib/mono/4.5/mscorlib.dll'. Remove one of the duplicate references. [/Users/vsts/agent/2.131.0/work/1/s/Champ.Android/Champ.Android.csproj]

    33 Warning(s)
    1 Error(s)

Time Elapsed 00:00:47.25
##[error]Error: /Library/Frameworks/Mono.framework/Versions/5_4_1/bin/msbuild failed with return code: 1
See https://go.microsoft.com/fwlink/?LinkId=760847.
##[section]Finishing: Build Xamarin.Android project