Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conflict between Microsoft.CSharp 2.0.5.0 and 4.0.0 on Xamarin (Warning MSB3277) #1324

Open
jandroalvarez opened this issue May 30, 2019 · 6 comments
Labels

Comments

@jandroalvarez
Copy link

Describe the bug
During the compilation of a Xamarin.iOS project, I'm getting the following error:

18>  There was a conflict between "Microsoft.CSharp, Version=2.0.5.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" and "Microsoft.CSharp, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
18>      "Microsoft.CSharp, Version=2.0.5.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" was chosen because it was primary and "Microsoft.CSharp, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" was not.

18>      References which depend on "Microsoft.CSharp, Version=2.0.5.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" [C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\ReferenceAssemblies\Microsoft\Framework\Xamarin.iOS\v1.0\Microsoft.CSharp.dll].
18>          C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\ReferenceAssemblies\Microsoft\Framework\Xamarin.iOS\v1.0\Microsoft.CSharp.dll

18>            Project file item includes which caused reference "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\ReferenceAssemblies\Microsoft\Framework\Xamarin.iOS\v1.0\Microsoft.CSharp.dll".
18>              Microsoft.CSharp

18>      References which depend on "Microsoft.CSharp, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" [C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\Microsoft.CSharp\v4.0_4.0.0.0__b03f5f7f11d50a3a\Microsoft.CSharp.dll].
18>          C:\Users\alex\.nuget\packages\csvhelper\12.1.2\lib\netstandard2.0\CsvHelper.dll
18>            Project file item includes which caused reference "C:\Users\alex\.nuget\packages\csvhelper\12.1.2\lib\netstandard2.0\CsvHelper.dll".
18>              C:\Users\alex\.nuget\packages\csvhelper\12.1.2\lib\netstandard2.0\CsvHelper.dll

To Reproduce
Steps to reproduce the behavior:

  1. Create a Xamarin.iOS project
  2. Add CsvHelper v12.1.2 as dependency
  3. Compile on VS2017 with detailed verbosity on output
  4. Warning MSB3277

Expected behavior
Warning MSB3277 shouldn't be detected

Additional context
It seems an MSBuild issue on Xamarin as some people already stated on dotnet/android#1261, dotnet/android#1607.

The issue dotnet/msbuild#3392 has been opened but there isn't any reply.

The same issue had been detected on Newtonsoft.Json v10.0.3 (see JamesNK/Newtonsoft.Json#1600) and fixed on v11.0.1. It seemed a matter of getting rid of Microsoft.CSharp NuGet package.

@JoshClose
Copy link
Owner

It looks like Newtonsoft.Json created a netstandard2.0 build and didn't need to use the Microsoft.CSharpt package anymore. I'm assuming that is because whatever feature is being used became a part of 2.0. I don't see any other way of getting the functionality without having Microsoft.CSharp included.

All the links keeps saying it's a MSBuild issue that needs to be fixed. I don't believe there is anything I can do to fix this.

@Roshan-Yadav
Copy link

I am also getting build warning: Found conflicts between different versions of "Microsoft.CSharp" that could not be resolved. These reference conflicts are listed in the build log when log verbosity is set to detailed. in my project.
To fix the warning, I tried updating Newtonsoft.Json to the latest version (12.0.3) and removing the references of Microsoft.CSharp from the project but no luck in fixing the warning.

@Lakshminatarajan
Copy link

When we install CsvHelper in the Xamarin project, we also get the same warning. Any solution or workaround would be appreciated.

Thanks.

@mdmota
Copy link

mdmota commented Dec 13, 2021

I am also getting build warning: Found conflicts between different versions of "Microsoft.CSharp" that could not be resolved. These reference conflicts are listed in the build log when log verbosity is set to detailed. in my project. To fix the warning, I tried updating Newtonsoft.Json to the latest version (12.0.3) and removing the references of Microsoft.CSharp from the project but no luck in fixing the warning.

removed the references of Microsoft.CSharp references from where?

@ivanrlg
Copy link

ivanrlg commented Jan 6, 2022

Hello I am getting the same error, any workaround?

@mdmota
Copy link

mdmota commented Jan 6, 2022

I decided to convert a csv to json and reading a json without using this dependency

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants