Aspose.Drawing, version=22.4.0.0 and System.Drawing.Common version=5.0.0.2 conflicts

Hello,

As I mentioned in the title there is a conflict between Aspose.Drawing and System.Drawing. I tried to add fully qualified namespaces and didn’t do anything. I also clone GitHub - aspose-drawing/Aspose.Drawing-for-.NET: Aspose.Drawing for .NET Examples and if I update the NuGet package to the latest for Aspose.Drawing getting the same error there as well.

We are using .net 5 at the moment. Is there any way that we can get rid of Aspose.Drawing from Aspose.Total There are some modules (packages) we are not using in Aspose.Total.

About the error what suggestion we can do? Thanks!

@emrebiber,

Aspose.Drawing for .NET API actually provides System.Drawing compatible API (where your code is using System.Drawing) to make it enhanced and fully/truly cross-platform. Please note, it is not the replacement to System.Drawing type. So, you need to add reference to System.Drawing in any case.
If you still have any issue or confusion, kindly do provide a sample VS.NET project (runnable), zip the project and post us, we will check it soon.

Hello again,

Thanks for the quick response. using System.Drawing is there already. I cannot send the whole project because it’s huge but I created a new project that has the exact same issue. WebApplication1.zip (48.6 KB)

Please check the ValuesController where there is conflict. Please let me know if you need anything else from my side. This is .NET 5 project as well with latest Aspose.Total package.

Thanks for your help :slight_smile:

@emrebiber,

Thanks for the sample project.

I tried to compile your sample but could not resolve certain errors, it also tries to include all APIs from Aspose for .NET package. So, I created/opened a new ASP.NET Core 5 web project in VS.NET 2022. I then added/installed Aspose.Drawing v22.5 to the project via nuget repos. I then wrote a sample code (after adding reference to System.Drawing namespace using System.Drawing; at the top) to Program.cs before creating/executing host builder. I build and run the code, it works fine and the output bitmap image is generated fine in the project folder. I have attached my sample project for your reference here.
WebApplication3.zip (4.7 MB)

1 Like

@Amjad_Sahi

Thanks for the sample project. It works fine as you said. However, I believe that issue is with Aspose.Total Package. I removed the Aspose.Drawing package and installed Aspose.Total Package and errors are back again. We bought Aspose.Total for .NET. I attached the sample project that you sent with my changes.
WebApplication3.zip (5.1 MB)

Is there any way that can we not include the packages that we don’t need? Let’s say Aspose.Total 25 packages in it and we are using only few of them. Can we somehow seperate them?

If you are using a few of Aspose for .NET components, it is better you install your desired APIs individually only one by one and manually through Nuget repos. Installing the whole Aspose.Total for .NET in your project will increase unnecessary size and may use resources for no good. So, you should install your desired components only in your project. See the document on how to install some .NET APIs into your project via Nuget repos.
Install or Update Aspose.Words for .NET using Manage NuGet Packages
Install Package using the Package Manager GUI
Install Aspose.Cells through NuGet
Installing Aspose.Drawing for .NET through NuGet

Hope, this helps a bit.