Created attachment 24828 [details]
sample app demonstrating the issue
Using an Android app which references a .netstandard 2.0 library I'm facing the conflict below.
Obviously MonoAndroid is referencing older (or tweaked CSharp) with different version.
Since I can't just get rid of MonoAndroid assembly, how can I resolve it?
here was a conflict between "Microsoft.CSharp, Version=220.127.116.11, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" and "Microsoft.CSharp, Version=18.104.22.168, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
2> "Microsoft.CSharp, Version=22.214.171.124, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" was chosen because it was primary and "Microsoft.CSharp, Version=126.96.36.199, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" was not.
2> References which depend on "Microsoft.CSharp, Version=188.8.131.52, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" [C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\ReferenceAssemblies\Microsoft\Framework\MonoAndroid\v1.0\Microsoft.CSharp.dll].
2> C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\ReferenceAssemblies\Microsoft\Framework\MonoAndroid\v1.0\Microsoft.CSharp.dll
2> Project file item includes which caused reference "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\ReferenceAssemblies\Microsoft\Framework\MonoAndroid\v1.0\Microsoft.CSharp.dll".
2> References which depend on "Microsoft.CSharp, Version=184.108.40.206, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" .
2> C:\Users\miha\documents\visual studio 2017\Projects\App1\packages\Newtonsoft.Json.10.0.3\lib\netstandard1.3\Newtonsoft.Json.dll
2> Project file item includes which caused reference "C:\Users\miha\documents\visual studio 2017\Projects\App1\packages\Newtonsoft.Json.10.0.3\lib\netstandard1.3\Newtonsoft.Json.dll".
2> Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL
2>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(1987,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.
Microsoft Visual Studio Enterprise 2017
Microsoft .NET Framework
Installed Version: Enterprise
Architecture Diagrams and Analysis Tools 00369-90200-01701-AA812
Microsoft Architecture Diagrams and Analysis Tools
Visual Basic 2017 00369-90200-01701-AA812
Microsoft Visual Basic 2017
Visual C# 2017 00369-90200-01701-AA812
Microsoft Visual C# 2017
Visual C++ 2017 00369-90200-01701-AA812
Microsoft Visual C++ 2017
Application Insights Tools for Visual Studio Package 8.8.00712.1
Application Insights Tools for Visual Studio
ASP.NET and Web Tools 2017 15.0.30726.0
ASP.NET and Web Tools 2017
ASP.NET Core Razor Language Services 1.0
Provides languages services for ASP.NET Core Razor.
ASP.NET Template Engine 2017 15.0.30726.0
ASP.NET Template Engine 2017
ASP.NET Web Frameworks and Tools 2017 5.2.50601.0
For additional information, visit https://www.asp.net/
Azure App Service Tools v3.0.0 15.0.30728.0
Azure App Service Tools v3.0.0
Cake for Visual Studio 0.1.2.0
Adds support for the Cake build tool in Visual Studio 2015 and 2017. Includes support for the Task Runner Explorer, new templates and bootstrapping important Cake files.
CodeRush for Roslyn 220.127.116.11
DevExpress CodeRush for Roslyn package.
Common Azure Tools 1.10
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.
Create layout wizard.
A useful tool for deploying DevExpress assemblies.
DevExpress.Win.LayoutAssistant Extension 1.0
DevExpress.Win.LayoutAssistant Visual Studio Extension Detailed Info
A Visual Studio Extension that brings the GitHub Flow into Visual Studio.
Markdown Editor 1.11.214
A full featured Markdown editor with live preview and syntax highlighting. Supports GitHub flavored Markdown.
Merq 1.1.17-rc (cba4571)
Command Bus, Event Stream and Async Manager for Visual Studio extensions.
Microsoft Continuous Delivery Tools for Visual Studio 0.3
Simplifying the configuration of continuous build integration and continuous build delivery from within the Visual Studio IDE.
Microsoft JVM Debugger 1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines
Microsoft MI-Based Debugger 1.0
Provides support for connecting Visual Studio to MI compatible debuggers
Microsoft Visual C++ Wizards 1.0
Microsoft Visual C++ Wizards
Microsoft Visual Studio VC Package 1.0
Microsoft Visual Studio VC Package
Mono Debugging for Visual Studio 4.6.8-pre (ec7034f)
Support for debugging Mono processes with Visual Studio.
NuGet Package Manager 4.3.1
NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.
Project File Tools 1.0.1
Provides Intellisense and other tooling for XML based project files such as .csproj and .vbproj files.
SlowCheetah - XML config transforms 1.0
This package enables you to transform your app.config or any other XML file based on the build configuration. It also adds additional tooling to help you create XML transforms.
SQL Server Data Tools 15.1.61707.200
Microsoft SQL Server Data Tools
Syntax Visualizer 1.0
An extension for visualizing Roslyn SyntaxTrees.
TypeScript tools for Visual Studio
Visual Studio Code Debug Adapter Host Package 1.0
Interop layer for hosting Visual Studio Code debug adapters in Visual Studio
Visual Studio Tools for Universal Windows Apps 15.0.26730.08
The Visual Studio Tools for Universal Windows apps allow you to build a single universal app experience that can reach every device running Windows 10: phone, tablet, PC, and more. It includes the Microsoft Windows 10 Software Development Kit.
WiX Toolset Visual Studio Extension 0.9.21.62588
WiX Toolset Visual Studio Extension version 0.9.21.62588
Copyright (c) .NET Foundation and contributors. All rights reserved.
Xamarin 18.104.22.168 (bd7e3753c)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.
Xamarin.Android SDK 22.214.171.124 (fb018c5)
Xamarin.Android Reference Assemblies and MSBuild support.
Xamarin.iOS and Xamarin.Mac SDK 126.96.36.199 (152b654)
Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.
XtraReports package 1.0
BTW, Json.Net nuget package triggers it, but I guess it can be any library.
I can CONFIRM this issue and I believe both https://github.com/Microsoft/msbuild/issues/1712 and https://github.com/Microsoft/msbuild/issues/608 are currently discussions for how to better relay this to developers so they can fix it.
So really I believe this happens because there is an explicit reference to Microsoft.CSharp 188.8.131.52 in the Xamarin.Android project when there is a reference to Microsoft.CSharp 184.108.40.206 in the netstandard library project from a library like JSON.NET.
Playing around with your sample, can you try to remove the explicit reference to the Microsoft.CSharp 220.127.116.11 item and then reinstall your Newtonsoft.Json/other library item so it will properly install the Microsoft.CSharp 4.3+ version? My question however is: Overriding this assembly that we distribute could end up breaking something else as the 18.104.22.168 version is from Mono and the 4.3+ version is from corefx. Given that mono is using corefx now, I think this should be okay. I am leaving this bug as CONFIRMED until someone else can take a gander at this.
Any news ?
Is it safe to remove the ref ?
@Jon Douglas [MSFT] - Can you follow up with "someone else" regarding this? I know this is a gray area as this warning pops up due to a 3rd party library. That being said, the 3rd party library is the most popular NuGet package out there and this warning is very annoying.
@Jon Douglas [MSFT] - We just followed your recommendations and everything appears to work fine after removing the explicit reference to Microsoft.CSharp 22.214.171.124, thanks!
(In reply to Derek Foulk from comment #4)
> @Jon Douglas [MSFT] - Can you follow up with "someone else" regarding this?
> I know this is a gray area as this warning pops up due to a 3rd party
> library. That being said, the 3rd party library is the most popular NuGet
> package out there and this warning is very annoying.
This is being tracked via the following:
You're the man! Thank you.