InsertClone Throws Error in Linux due to System.Drawing.Common Is Not Supported

using Aspose.Slides;
namespace Aspose.Words.Examples
{
    public class Sample4
    {
        static void Main(string[] args)
        {
            using Presentation sourcepres = new("./slidetest2.pptx");
            using Presentation targetpres = new("./slidetest1.pptx");
            ISlideCollection sourceSlds = sourcepres.Slides;
            ISlideCollection targetslds = targetpres.Slides;

            targetslds.InsertClone(2, sourceSlds[2]);
        }
    }
}

csproj file

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net6.0</TargetFramework>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="Aspose.Total" Version="23.6.0" />
  </ItemGroup>
</Project>

When run this program using net6.0 in Linux platform(ubuntu), following error is thrown.

Unhandled exception. System.PlatformNotSupportedException: System.Drawing.Common is not supported on this platform.
at System.Drawing.FontFamily.get_GenericSerif()
:
:
at Aspose.Slides.MasterSlideCollection.(MasterSlide , Boolean )
at Aspose.Slides.MasterSlideCollection.(IMasterSlide , Boolean )
at Aspose.Slides.SlideCollection.AddClone(ISlide sourceSlide)
at Aspose.Slides.SlideCollection.InsertClone(Int32 index, ISlide sourceSlide)

I know that System.Drawing.Common is not supported on Linux platform in Net 6.0.
Also, tried to set “System.Drawing.EnableUnixSupport”: true. But the error still occurs.

How to resolve this error? Please advice me.

@shanaki,
Thank you for contacting support. We are working on the issue you described and will get back to you as soon as possible.

@shanaki,
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): SLIDESNET-44103

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.

Thanks.
I found that calling Save() simply also throws the same exception on Linux platform.
Aspose.Slides.Presentation.Save()

@shanaki,
Thank you for the information. I passed it on to our developers.

Release note mention that Aspose.Slides.dll for crossplatform is available for ZIP and MSI releases. Does this dll resolve the above exception error on Linux?
If so, please let me know how to use it because I could not find instruction to use Aspose.Slides.dll for crossplatform.

.NET 6: Nuget depends on System.Drawing.Common, a cross-platform version is available in the ZIP and MSI releases

Aspose.Slides assembly for .NET 6 will now be presented as:

  • Nuget package: dependency on System.Drawing.Common, Windows only.
  • ZIP and MSI release: will include two variants:
    • win: build for Windows with a dependency on System.Drawing.Common.
    • cross-platform: no dependence on System.Drawing.Common, supports Windows, Linux and MacOS.

@shanaki,
Could you please clarify which IDE you are using to develop your project with Aspose.Slides?

I’m using Visual Studio Code.

@shanaki,
Thank you for the details. I am working on your request and will get back to you as soon as possible.

Has there been any update on this. We are also interested in the answer. The download contains several dlls, but no guidance on which to use and how.

@shanaki, @eirik.rude,
We are awaiting the guidance from our development team and will provide it to you as soon as it is ready. Thank you for your patience.

@shanaki, @eirik.rude,
The zip package contains Aspose.Slides assemblies.

  1. Aspose.Slides.zip\Aspose.Slides\net6.0\crossplatform\ contains DLLs that should be referenced in your project.
  2. Other DLLs and dylib files should be placed in the build output directory since Aspose.Slides.dll depends on them.

Please let us know if you have any difficulty with this.

Copy all files under crossplatform into bin/Debug/net6.0
Then, execute “dotnet run --no-build” (Because, dotnet run rebuilds and overwrites copied Aspose.Slides.dll with original Aspose.Slides.dll.)
Following error occurs.

Unhandled exception. System.DllNotFoundException: Unable to load shared library 'libaspose.slides.drawing.capi_x86_64_libstdcpp_libc2.23' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: liblibaspose.slides.drawing.capi_x86_64_libstdcpp_libc2.23: cannot open shared object file: No such file or directory
   at System.Runtime.InteropServices.NativeLibrary.LoadByName(String libraryName, QCallAssembly callingAssembly, Boolean hasDllImportSearchPathFlag, UInt32 dllImportSearchPathFlag, Boolean throwOnError)
   at System.Runtime.InteropServices.NativeLibrary.LoadLibraryByName(String libraryName, Assembly assembly, Nullable`1 searchPath, Boolean throwOnError)
   at System.Runtime.InteropServices.NativeLibrary.Load(String libraryName, Assembly assembly, Nullable`1 searchPath)
   at .(String , Assembly , Nullable`1 )
   at System.Runtime.InteropServices.NativeLibrary.LoadLibraryCallbackStub(String libraryName, Assembly assembly, Boolean hasDllImportSearchPathFlags, UInt32 dllImportSearchPathFlags)
   at .a(Int32 a, Int32 b, Int32 c, IntPtr& d)
   at .(Size ,  )
   at .(Size )
   at Aspose.Slides.Slide.GetThumbnail(Size imageSize)
   at Presentation )
   at resentation , Stream ,  , IPptxOptions, InterruptionToken )
   at Aspose.Slides.Presentation.(Stream ,  , IPptxOptions )
   at Aspose.Slides.Presentation.Save(Stream stream, SaveFormat format, ISaveOptions options)
   at Aspose.Slides.Presentation.Save(String fname, SaveFormat format)

Please let me know more detail how to do following things.

1. Aspose.Slides.zip\Aspose.Slides\net6.0\crossplatform\ contains DLLs that should be referenced in your project.

2. Other DLLs and dylib files should be placed in the build output directory since Aspose.Slides.dll depends on them.

I’m using Linux platform.

@shanaki,
Thank you for the information. I forwarded it to our developers.

any update on this?

@shanaki,
I’ve requested instructions from our developers for you again. We are waiting for a response and will provide the details to you soon.

@shanaki,
Please follow the steps below:

  1. Download this zip package: Downloads ---New Releases-aspose.slides-for-.net-23.6(dlls-only).
  2. Extract Aspose.Slides_23.6.zip\Aspose.Slides\net6.0\crossplatform\ files.
  3. Aspose.Slides.dll is a .NET assembly. It should be referenced in the project.
  4. aspose.slides.drawing.capi_vc14x64.dll, aspose.slides.drawing.capi_vc14x86.dll, libaspose.slides.drawing.capi_x86_64_libstdcpp_libc2.23.so are C++ libraries, each for the corresponding target platform (these libraries should be included in the project and set to copy to the output directory because Aspose.Slides.dll will load the required lib on the startup).

That’s all. I hope this will help you.

Thanks for providing the steps.

I have additional questions for each step.

At first, I created a new project.
% dotnet new console -o “linuxeval2”.
Then, add Aspose.Slides.NET 23.6.0 package.
% dotnet add package Aspose.Slides.NET --version 23.6.0

Then, I follow your instruction steps.

  1. Download this zip package from Downloads ---New Releases-aspose.slides-for-.net-23.6(dlls-only)

  2. Extract Aspose.Slides_23.6.zip\Aspose.Slides\net6.0\crossplatform\ files.

I copied crossplatform directory into the project like this.
$ ls
Program.cs crossplatform/ linuxeval2.csproj obj/

All required files(dll and so files) are located at crossplatform directory in this project.

  1. Aspose.Slides.dll is a .NET assembly. It should be referenced in the project.
    Then, I’m modifying csproj file like this. Is this correct?
Exe net6.0 enable enable

← add this part to refer crossplatform\Aspose.Slides.dll →

<Reference Include="Aspose.Slides">
  <SpecificVersion>False</SpecificVersion>
  <HintPath>crossplatform\Aspose.Slides.dll</HintPath>
</Reference>

As to step4, you mentioned that “set to copy to the output directory”. What is “output” directory? In my case, where should I copy aspose.slides.drawing.capi_vc14x64.dll, aspose.slides.drawing.capi_vc14x86.dll, libaspose.slides.drawing.capi_x86_64_libstdcpp_libc2.23.so?

Let me try to add these block in csproj file and try if it resolves the error on Linux.

<ItemGroup>
    <Reference Include="Aspose.Slides">
      <SpecificVersion>False</SpecificVersion>
      <HintPath>crossplatform\Aspose.Slides.dll</HintPath>
    </Reference>
  </ItemGroup>

  <ItemGroup>
    <AssetsSourceFiles Include="crossplatform\*.*"/>
  </ItemGroup>

  <Target Name="CopyCustomContent" AfterTargets="AfterBuild">
    <Copy SourceFiles="@(AssetsSourceFiles)" DestinationFolder="$(OutDir)" SkipUnchangedFiles="true" />
  </Target>

@shanaki,
We are waiting for the detailed instruction from our development team for you. We apologize for any inconvenience.