Conflicts with other Aspose products

If I use Aspose.Drawing and also something like Aspose.Cells to set the background color of a cell (it’s looking for System.Drawing.Color), then the app can’t compile and I can’t see any way to scope the namespaces. You cannot alias the namespace from Aspose.Drawing. Trying to have using Aspose.Drawing won’t work either.

@jojoshua,

Could you please create a standalone sample VS.NET project using both Aspose.Cells and Aspose.Drawing, zip the application and post us (with all the resource files) to show the issue, we will check it soon.

PS. please try using latest versions of the APIs:

I am using the latest versions. The issue with much discussion and examples can be found Public System.Drawing.Imaging Types in Aspose.Slides.dll Cause Conflict - #23 by jojoshua where the issue was found using aspose.slides

Are you saying that aspose.drawing is not the common issue?.. Or do all the other aspose products (cells, slides, word, etc) need to be fixed?

@jojoshua,

For Apose.Cells, we have completed the migration of the graphics library. We use SkiaSharp instead of System.Drawing.Common on non-Windows systems, as suggested in Microsoft’s official documentation. Could you please see the topic for your reference.
https://docs.aspose.com/cells/net/how-to-run-aspose-cells-for-net6/

I am using NET 4.8, does Aspose.Cells also use SkiaSharp for that? I see the article reference net6

@jojoshua,

No, SkiaSharp library is used in .NET6.0. For .NET4.x, we use System.Drawing.

Thanks for confirming. That means I can’t use aspose.drawing with other aspose products unless the net 4.x versions also start using Skia. Is there any chance for that to happen @amjad.sahi?

@jojoshua,

Apparently you cannot use Aspose.Cells in the same project (if you are performing some drawing or formatting operations) when you have imported/added reference to Aspose.Drawing instead of System.Drawing library.

I tested your scenario/case and noticed the issue as you mentioned when using both Aspose.Drawing for .NET and Aspose.Cells for .NET in a single project (I used console application (.NET 4.8) as target framework). I found compile time error when setting cell shading color in code: “The type ‘Color’ is defined in an assembly that is not referenced. You must add a reference to assembly ‘System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’”. It seems Aspose.Drawing conflicts with other Aspose products (e.g., Aspose.Cells).

We have logged a ticket with an id “CELLSNET-53523” for your issue. We will investigate and look into the details of the issue.

Once we have an update on it, we will let you know.

@amjad.sahi Yeah what you said is exactly what I encountered. Thank you for investigating this.

@jojoshua,

You are welcome. We will keep you posted with updates on it.

@jojoshua,

We evaluated and there is nothing to do with Aspose.Cells. In Aspose.Drawing, it defines its own System.Drawing namespace and classes such as Color. We found the compile time error exists even when referencing to both System.Drawing and Aspose.Drawing in a simple .NET framework project(without reference to Aspose.Cells):

namespace ConsoleApp1
{
    public class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine(Program.GetColor());
        }
        //reference to System.Drawing.Color causes compile error
        public static System.Drawing.Color GetColor()
        {
            return System.Drawing.Color.Red;
        }
    }
}

We think Aspose.Drawing team should evaluate and check whether such kind of issues could be resolved.

I am moving your thread back to Aspose.Drawing category.

@jojoshua,

Aspose.Drawing product team will investigate your issue in details. We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): DRAWINGNET-1350

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

You can use Aspose.Drawing.Common. Same API but in Aspose.Drawing namespace

@jojoshua,

Please note, Aspose.Drawing is a replacement for System.Drawing, so you can’t have both in one project. To use Aspose SDKs with System.Drawing in one project, instead of Aspose.Drawing package, please use Aspose.Drawing.Common package. Aspose.Drawing.Common defines all classes in Aspose.Drawing namespace.

@amjad.sahi,

Aspose.Drawing.Common might work if I only use aspose sdks needing system.Drawing but I have others that need system.Drawing.color and it won’t work with the aspose reference only.

@jojoshua,

I am not sure about your issue and how to reproduce it. Could you please create a standalone sample VS.NET application using Aspose.Cells and Aspose.Drawing.Common, etc., zip the application and post us (with all the resource files) to reproduce the issue, we will check it soon.

My need to replace system.drawing was needed very soon so I decided to not use Aspose.Drawing and instead directly convert to use SkiaSharp.

You can use Aspose.Drawing.Common and the following trick (add to all of cs files, can be done with utility):

#if NETSTANDARD2_0_OR_GREATER || NETCOREAPP2_0_OR_GREATER
using Aspose.Drawing;
#else
using System.Drawing;
#endif

Other targets:

Thanks for confirming. That means I can’t use aspose.drawing with other aspose products unless the net 4.x versions also start using Skia.

fethiye tours