Bug 44165 - Android projects referencing System.Reactive v.3.0.0 Nuget fail with "Error CS1703 Multiple assemblies with equivalent identity have been imported"
Summary: Android projects referencing System.Reactive v.3.0.0 Nuget fail with "Error C...
Status: RESOLVED DUPLICATE of bug 43494
Alias: None
Product: Visual Studio Extensions
Classification: Xamarin
Component: General ()
Version: 4.2.0 (C8)
Hardware: PC Windows
: --- critical
Target Milestone: 4.2.0 (C8)
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2016-09-10 08:48 UTC by Frank Buckley
Modified: 2016-09-12 16:46 UTC (History)
4 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 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:
RESOLVED DUPLICATE of bug 43494

Description Frank Buckley 2016-09-10 08:48:52 UTC
# Steps to reproduce

Add reference in Android project to System.Reactive NuGet v.3.0.0

# Expected behavior

Project builds

# Actual behaviour

Build fails:

Error CS1703 Multiple assemblies with equivalent identity have been imported: 'C:\dsedev\src\Apps\DSE\Apps\packages\System.Runtime.InteropServices.WindowsRuntime.4.0.1\lib\netstandard1.3\System.Runtime.InteropServices.WindowsRuntime.dll' and 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\Facades\System.Runtime.InteropServices.WindowsRuntime.dll'. Remove one of the duplicate references.

# Supplemental info (logs, images, videos)

See discussion here: https://github.com/Reactive-Extensions/Rx.NET/issues/261

Is this a Xamarin or Rx.Net issue?

# Test environment (full version information)

Microsoft Visual Studio Enterprise 2015
Version 14.0.25425.01 Update 3
Microsoft .NET Framework
Version 4.6.01586

Installed Version: Enterprise

Architecture and Modeling Tools   00322-80000-00000-AA013
LightSwitch for Visual Studio 2015   00322-80000-00000-AA013
Microsoft Visual Studio Tools for Applications 2015   00322-80000-00000-AA013
Visual Basic 2015   00322-80000-00000-AA013
Visual C# 2015   00322-80000-00000-AA013
Visual C++ 2015   00322-80000-00000-AA013
Visual F# 2015   00322-80000-00000-AA013
Add New File   3.5
ASP.NET and Web Tools 2015.1   14.1.20810.0
ASP.NET Web Frameworks and Tools 2012.2   4.1.41102.0
ASP.NET Web Frameworks and Tools 2013   5.2.40314.0
Azure App Service Tools v2.9.1   14.0.20622.0
Azure Data Lake Node   1.0
Azure Data Lake Tools for Visual Studio   2.0.6000.0
Browser Sync   1.2.22
Bundler & Minifier   2.1.279
Command Bus, Event Stream and Async Manager   Merq
Common Azure Tools   1.8
File Icons   1.3
File Nesting   2.5.63
GitHub.VisualStudio   1.0
Image Optimizer   3.6.93
Image Sprites   1.3.40
JavaScript Language Service   2.0
JavaScript Project System   2.0
JetBrains ReSharper Ultimate 2016.2    Build 106.0.20160818.163633
Markdown Editor   1.7.154
Microsoft .NET Core Tools (Preview 2)   14.1.20810.0
Microsoft Azure HDInsight HQL Service   2.0.6000.0
Microsoft Azure HDInsight Tools for Visual Studio   2.0.6000.0
Microsoft Azure Mobile Services Tools   1.4
Microsoft Azure Tools   2.9
Microsoft Azure Tools for Microsoft Visual Studio 2015 - v2.9.40701.9
NuGet Package Manager   3.5.0
Office Developer Tools for Visual Studio 2015 ENU   14.0.23928
Open Command Line   2.1.175
Package Installer   1.8.85
PreEmptive Analytics Visualizer   1.2
SQL Server Analysis Services   13.0.1605.88
SQL Server Data Tools   14.0.60629.0
SQL Server Integration Services   
SQL Server Reporting Services   13.0.1605.88
ToolWindowHostedEditor   1.0
TypeScript   1.8.36.0
Visual Studio Tools for Universal Windows Apps   14.0.25527.01
Web Compiler   1.11.319
Web Essentials 2015.3   3.0.235
Workflow Manager Tools 1.0   1.0
Xamarin   4.2.0.675 (c54ec37)
Xamarin.Android   7.0.0.15 (f4db8a5)
Xamarin.iOS   10.0.0.4 (d1ee3ba)
Comment 1 Brendan Zagaeski (Xamarin Team, assistant) 2016-09-12 16:33:49 UTC
Thanks for the report!  I believe this is a duplicate of Bug 43494.

According to my investigation on that bug, the issue is a tiny problem with the System.Runtime.InteropServices.WindowsRuntime.4.0.1 NuGet package.  It seems to be missing a _._ file for Android (to tell the NuGet package manager that Xamarin.Android has its own existing implementation of the assembly).  That file should be in:

System.Runtime.InteropServices.WindowsRuntime.4.0.1\lib\monoandroid\_._




## Workaround

Manually remove the extraneous reference to the `.dll` from the NuGet package:

System.Runtime.InteropServices.WindowsRuntime.4.0.1\lib\netstandard1.3\System.Runtime.InteropServices.WindowsRuntime.dll


(The reference from Xamarin.Android's `Facades\` directory is the "good" reference that you want to keep.)

*** This bug has been marked as a duplicate of bug 43494 ***
Comment 2 Brendan Zagaeski (Xamarin Team, assistant) 2016-09-12 16:46:04 UTC
To comment on one other point from the GitHub issue that might raise questions about the proposed workaround:

> I tried removing the reference to the assembly from the package, but then a
> release build fails with a linker error

That symptom sounds like Mono needs to add a few more type or method declarations to the "dummy" implementation of "System.Runtime.InteropServices.WindowsRuntime" that it provides.  Cycle 8 does include changes to several types to cover more of the .NET Standard surface area, so with a bit of luck that linker issue is hopefully already fixed in the current Beta versions.


(See also the article on [1] for a little more background about the linker issue.  In particular, the linker issue matches up with "layer 2" of the example issue discussed there.
[1] https://developer.xamarin.com/guides/cross-platform/troubleshooting/questions/pcl-case-study/)