QRCoder icon indicating copy to clipboard operation
QRCoder copied to clipboard

System.Drawing.Common version conflict

Open twinharbor opened this issue 4 years ago • 4 comments

I'm running into an issue trying to use this library. I made a brand new project and added the nuget and it won't compile.

The results show: Found conflicts between different versions of "System.Drawing.Common" that could not be resolved. There was a conflict between "System.Drawing.Common, Version=4.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51" and "System.Drawing.Common, Version=4.0.0.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51". "System.Drawing.Common, Version=4.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51" was chosen because it was primary and "System.Drawing.Common, Version=4.0.0.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51" was not. References which depend on "System.Drawing.Common, Version=4.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51" [/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib/mono/Xamarin.iOS/Facades/System.Drawing.Common.dll]. /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib/mono/Xamarin.iOS/Facades/System.Drawing.Common.dll Project file item includes which caused reference "/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib/mono/Xamarin.iOS/Facades/System.Drawing.Common.dll".

To reproduce:

  • I created a new project for ios and android in xamarin. All latest versions, I believe.
  • I added nuget for System.Drawing.Common 5.0.2
  • Add nuget for QRCoder
  • Compile and the error pops up.

Versions I have here for reference:

  • Xamarin.forms 5.0.0.2012
  • NetStandard.Library 2.0.3
  • Visual Studio for Mac 8.10.3

thanks in advance for any insight!

twinharbor avatar Jun 28 '21 20:06 twinharbor

Same problem here.

eliasribeiro avatar Aug 18 '21 10:08 eliasribeiro

I am facing with the same issue on Xamarin.Android (.NET 6). QRCoder version: 1.4.3

  Assembly 'QRCoder' with identity 'QRCoder, Version=1.4.3.0, Culture=neutral, PublicKeyToken=c4ed5b9ae8358a28' uses 'System.Drawing.Common, Version=4.0.0.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' which has a higher version than referenced assembly 'System.Drawing.Common' with identity 'System.Drawing.Common, Version=4.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'

Update

        using (QRCodeGenerator qrGenerator = new QRCodeGenerator())
        using (QRCodeData qrCodeData = qrGenerator.CreateQrCode("The text which should be encoded.", QRCodeGenerator.ECCLevel.Q))
        using (QRCode qrCode = new (qrCodeData))
        {
            // Bitmap qrCodeImage = qrCode.GetGraphic(20);
        }

When I comment out this Bitmap qrCodeImage = qrCode.GetGraphic(20);, it throws no error.

mozesa avatar May 17 '22 12:05 mozesa

Same problem here - has anyone found a workaround?

CrewNerd avatar Aug 01 '22 22:08 CrewNerd

I wound up abandoning use of this entirely. I found BarcodeScanner.XF for scanning codes and I didn't wind up needing to generate codes within Xamarin in my case.

twinharbor avatar Aug 02 '22 11:08 twinharbor