Hi Team,
I’m getting below error when I add Aspose.Drawing nuget to my dotnet 6 application.
|Error (active)|CS0433|The type ‘ImageFormat’ exists in both ‘Aspose.Drawing, Version=24.7.0.0, Culture=neutral, PublicKeyToken=716fcc553a201e56’ and ‘System.Drawing.Common, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51’
Is there any way to resolve this.
Thanks,
Ishara
@isharasp,
Could you please try using Aspose.Drawing.Common package instead of Aspose.Drawing package. Please note, it uses Aspose.Drawing namespace and does not conflict with System.Drawing in .NET Framework.
Please give it a try and let us know if you still find any issue.
Hi @amjad.sahi , Thanks for taking a look at this.
When I add the Aspose.Drawing.Common it will end up me giving this error. Note that im on dotnet 6 and running this on linux docker.
System.PlatformNotSupportedException: System.Drawing.Common is not supported on this platform.
at System.Drawing.Imaging.ImageFormat.get_Jpeg()
@isharasp,
Thanks for your feedback and providing further details.
For your original issue with Aspose.Drawing and System.Drawing.Common conflicts, could you please try to create aliases for the conflicting namespaces to distinguish between the two ImageFormat
types. Alternatively, try using fully qualify the type names where conflicts occur if you could resolve the issue?
You can enable support of System.Drawing.Common on .Net 6, but it is tricky and does not work on .Net 7+
In this way you can drop support of System.Drawing namespace and use Multi-Targeting compilation with System.Drawing for .Net Framework and Aspose.Drawing for .Net Core/.Net 6+