Microsoft CSharp Version Conflict
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.
What version of CsvHelper are you using?
@JoshClose version 27.1.1
Have you tried binding redirects? https://docs.microsoft.com/en-us/dotnet/framework/configure-apps/redirect-assembly-versions
@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
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 Hmmmm weird, if I remove CsvHelper the error goes away. So how is it .net?
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.
@chucklu Do you have any ideas on this one?
@JoshClose I removed all other nugets and I still get the warning with CsvHelper installed.
Can you create an example project that reproduces the issue so I can see?
https://github.com/xamarin/xamarin-android/issues/2291
@JoshClose Have no experience on Xamarin project. And there is already a similar issue https://github.com/JoshClose/CsvHelper/issues/1324
@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?
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 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.
What do your .csproj file look like?
@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