Bug 60351 - No way to resolve conflict between "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" and "mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e".
Summary: No way to resolve conflict between "mscorlib, Version=4.0.0.0, Culture=neutra...
Status: CONFIRMED
Alias: None
Product: Android
Classification: Xamarin
Component: General ()
Version: 8.0 (15.4)
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Jonathan Pryor
URL:
Depends on:
Blocks:
 
Reported: 2017-10-24 15:54 UTC by Jon Douglas [MSFT]
Modified: 2018-03-30 10:59 UTC (History)
8 users (show)

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


Attachments
Reproduction (43.73 KB, application/x-zip-compressed)
2017-10-24 15:58 UTC, Jon Douglas [MSFT]
Details


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 for Bug 60351 on Developer Community or GitHub if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: Developer Community HTML or GitHub Markdown
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:
Status:
CONFIRMED

Description Jon Douglas [MSFT] 2017-10-24 15:54:41 UTC
## Description

When referencing a .NET Standard Library in a Xamarin.Android project, there becomes a conflict warning in MSBuild output:

No way to resolve conflict between "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" and "mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e". Choosing "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" arbitrarily. 

Full Output in ResolveAssemblyReference Task:

https://gist.github.com/JonDouglas/c8d335d84ebeb78ede242a07c7ec4e5a

This seems to happen because there's a mono mscorlib reference in MonoAndroid.dll and also a .NET mscorlib reference in .NET Standard Library.dll which conflict(2.0.5.0 and 4.0.0.0 respectfully)

There are many conflict warnings that come from other assemblies as well such as System.Xml, Microsoft.CSharp, and others for example. I believe this is caused because of the Mono vs. .NET versions being added to a project.

There is another similar bug reported here: https://bugzilla.xamarin.com/show_bug.cgi?id=59600

## Reproduction

Attached. Rebuild the Android project and search for the conflict warning message
Comment 1 Jon Douglas [MSFT] 2017-10-24 15:58:08 UTC
Created attachment 25423 [details]
Reproduction
Comment 2 Riddhish Ojha 2017-11-14 05:11:18 UTC
I'm also facing this issue in my Xamarin.Forms PCL project when I try to build Android project in the solution. 

The error message: 
No way to resolve conflict between "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" and "mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e". Choosing "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" arbitrarily.


Project & System details:
Windows 10 
Visual Studio 2017 (15.4.3)
Xamarin.Forms 2.4.0.74863
Comment 3 Dave Friedel 2017-12-20 21:27:35 UTC
Same here - same issue
Comment 4 mrwcjoughin 2017-12-30 05:56:25 UTC
Shame issue for me when netstandard 1.6 is referenced!
Comment 5 david 2018-01-05 22:41:01 UTC
Same issue with netstandard 2 referenced (with newtonsoft)
Comment 6 Chad 2018-03-30 10:59:05 UTC
Same issue with sqlite-net-pcl v1.4.118