CsvHelper icon indicating copy to clipboard operation
CsvHelper copied to clipboard

Microsoft CSharp Version Conflict

Open sisaacks opened this issue 4 years ago • 17 comments

Describe the bug A clear and concise description of what the bug is. I have an Xamarin Cross Platform App and I am using syncfusion controls. When I add your nuget to my project I get a Microsft.Csharp compatibility issue..more specifically conflicts beween versions 2.0.5.0 and 4.0.0.0.
This happens for both IOS and Android projects.

To Reproduce Steps to reproduce the behavior: Add the nuget to a project that contains syncfusion controls and build the project

Expected behavior There would be no compatibility warning

Screenshots Severity Code Description Project File Line Suppression State Warning Found conflicts between different versions of "Microsoft.CSharp" that could not be resolved. 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". "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. References which depend on "Microsoft.CSharp, Version=2.0.5.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" [C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\ReferenceAssemblies\Microsoft\Framework\Xamarin.iOS\v1.0\Microsoft.CSharp.dll]. C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\ReferenceAssemblies\Microsoft\Framework\Xamarin.iOS\v1.0\Microsoft.CSharp.dll Project file item includes which caused reference "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\ReferenceAssemblies\Microsoft\Framework\Xamarin.iOS\v1.0\Microsoft.CSharp.dll". Microsoft.CSharp

If applicable, add screenshots to help explain your problem.

Additional context Add any other context about the problem here.

sisaacks avatar Oct 25 '21 15:10 sisaacks

What version of CsvHelper are you using?

JoshClose avatar Oct 26 '21 15:10 JoshClose

@JoshClose version 27.1.1

sisaacks avatar Oct 26 '21 15:10 sisaacks

Have you tried binding redirects? https://docs.microsoft.com/en-us/dotnet/framework/configure-apps/redirect-assembly-versions

JoshClose avatar Oct 26 '21 15:10 JoshClose

@JoshClose no i have not....I read the link you provided, but I am not entirely sure how I would add that to my config. Do you have an example perhaps? I am not sure where I would do this in an Xamarin project and not finding much on google

sisaacks avatar Oct 26 '21 16:10 sisaacks

I don't know. There are other threads in here where people have had these issues and solved them. This isn't a CsvHelper issue, it's a general issue with .NET.

JoshClose avatar Oct 27 '21 15:10 JoshClose

@JoshClose Hmmmm weird, if I remove CsvHelper the error goes away. So how is it .net?

sisaacks avatar Oct 27 '21 15:10 sisaacks

2 libraries may have different versions of the same dependency. That is a common scenario. I haven't used Xamarin before, so I don't know how they handle it.

JoshClose avatar Oct 27 '21 15:10 JoshClose

@chucklu Do you have any ideas on this one?

JoshClose avatar Oct 27 '21 15:10 JoshClose

@JoshClose I removed all other nugets and I still get the warning with CsvHelper installed.

sisaacks avatar Oct 27 '21 16:10 sisaacks

Can you create an example project that reproduces the issue so I can see?

JoshClose avatar Oct 27 '21 17:10 JoshClose

https://github.com/xamarin/xamarin-android/issues/2291

JoshClose avatar Oct 27 '21 22:10 JoshClose

@JoshClose Have no experience on Xamarin project. And there is already a similar issue https://github.com/JoshClose/CsvHelper/issues/1324

chucklu avatar Oct 28 '21 03:10 chucklu

@JoshClose it does look like someone added a bug with the same reason I did. The Xamarin issue you brought up is from 2018. Do we have any idea how to resolve this warning?

sisaacks avatar Nov 01 '21 13:11 sisaacks

Try using binding redirects. Maybe it's been fixed and that issue hasn't been updated. It's a very common thing, so I would think there would be more talk in that issue.

If that doesn't work, you can download the source for CsvHelper, change the dependency to match syncfusion, and build. Building is really simple in CsvHelper. If you get to this point and need help, I can walk you through it.

JoshClose avatar Nov 01 '21 15:11 JoshClose

@JoshClose from what I have read xamarin does not support binding redirects....at least I have not found anything saying so or examples of how to do this. Yeah I would need some guidance how to do what you stated above.

sisaacks avatar Nov 01 '21 15:11 sisaacks

What do your .csproj file look like?

JoshClose avatar Nov 01 '21 17:11 JoshClose

@JoshClose did you ever find a resolve for this? I am not the only person.....there are some others have the same issue https://github.com/JoshClose/CsvHelper/issues/1324

Severity	Code	Description	Project	File	Line	Suppression State
Warning		Found conflicts between different versions of "Microsoft.CSharp" that could not be resolved.
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".
    "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.
    References which depend on "Microsoft.CSharp, Version=2.0.5.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" [C:\Program Files\Microsoft Visual Studio\2022\Professional\Common7\IDE\ReferenceAssemblies\Microsoft\Framework\MonoAndroid\v1.0\Microsoft.CSharp.dll].
        C:\Program Files\Microsoft Visual Studio\2022\Professional\Common7\IDE\ReferenceAssemblies\Microsoft\Framework\MonoAndroid\v1.0\Microsoft.CSharp.dll
          Project file item includes which caused reference "C:\Program Files\Microsoft Visual Studio\2022\Professional\Common7\IDE\ReferenceAssemblies\Microsoft\Framework\MonoAndroid\v1.0\Microsoft.CSharp.dll".
            Microsoft.CSharp

sisaacks avatar Dec 08 '22 00:12 sisaacks