Aspose.Slides Linux Container - System.PlatformNotSupportedException: System.Drawing.Common Is Not Supported on non-Windows Platforms

@sudi.karmacharya,

If you have a valid license for Aspose.Total, it should work with Aspose.Slides.NET6.CrossPlatform as well. Please ensure that the following code is executed in your application before any other operations with Aspose.Slides:

Aspose.Slides.Metered metered = new Aspose.Slides.Metered();
metered.SetMeteredKey("<valid public key>", "<valid private key>");

The Metered class should be used from the Aspose.Slides.NET6.CrossPlatform library.

Metered Licensing|Aspose.Slides Documentation

Could you please share the Dockerfile you used?

1 Like

Hey @andrey.potapov,

Thanks for the pointer on setting keys for Aspose slides. I had missed that on my end. However, it seems that Aspose.Slides is referenced when the Metered class is used.

The Metered class should be used from the Aspose.Slides.NET6.CrossPlatform library.

How do I do this? The documentation referenced in the NuGet gallery leads to Aspose.Slides docs.

Please see the attached file for the contents of Dockerfile.
Screenshot 2025-04-17 at 15.03.34.png (54.6 KB)

Thank you.

@sudi.karmacharya,

To ensure that only the cross‑platform build is referenced, three practical approaches exist.

Approach 1

Suppress the classic assembly that flows in through Aspose.Total and add the cross‑platform package. In the project file, update the transitive dependency so that the classic DLL is never copied, then reference Aspose.Slides.NET6.CrossPlatform explicitly:

<ItemGroup>
  <PackageReference Include="Aspose.Total" Version="25.2.0" />

  <!-- Silence the classic Aspose.Slides that Aspose.Total pulls in -->
  <PackageReference Update="Aspose.Slides.NET"
                    ExcludeAssets="all"
                    PrivateAssets="all" />

  <!-- Bring in the cross‑platform assembly -->
  <PackageReference Include="Aspose.Slides.NET6.CrossPlatform" Version="25.2.0" />
</ItemGroup>

Approach 2

Replace Aspose.Total with only the individual Aspose packages actually needed and keep Aspose.Slides.NET6.CrossPlatform as a separate reference. This removes hidden duplication permanently if the project does not rely on every library included in the meta‑package.

Approach 3

Keep both assemblies side by side and disambiguate them with extern alias when some features require the GDI‑based classic build. Give each package a unique alias in the project file:

<ItemGroup>
  <PackageReference Include="Aspose.Total" Version="25.2.0">
    <Aliases>SlidesClassic</Aliases>
  </PackageReference>
  <PackageReference Include="Aspose.Slides.NET6.CrossPlatform" Version="25.2.0">
    <Aliases>SlidesCrossPlatform</Aliases>
  </PackageReference>
</ItemGroup>

Then reference the desired implementation in code:

extern alias SlidesCrossPlatform; // cross‑platform version
extern alias SlidesClassic; // classic version, if ever required

using SlidesCrossPlatform::Aspose.Slides;

var presentation = new Presentation(); // resolved to cross‑platform version

Unless the project genuinely needs capabilities unique to the GDI‑based build, excluding the classic assembly or removing Aspose.Total altogether keeps the build cleaner and avoids accidentally loading the wrong DLL at runtime.

Thank you for the Dockerfile. I need some time to check the issue. I will get back to you as soon as possible.

@sudi.karmacharya,

I was able to run a Linux container using the Dockerfile you provided, create a presentation, and save it to a PPTX file. Please try using the attached sample project: SampleApp.zip (you only need to add the Aspose.Slides.NET6.CrossPlatform via NuGet).
I hope this will help you.

1 Like

Hey @andrey.potapov,

Thank you so much for your detailed answer. I’ve tried all your approaches, please see below:

  • Approach 1: My project file has the following content:
<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>net8.0</TargetFramework>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Aspose.Total" Version="25.2.0" />
    <!-- Silence the classic Aspose.Slides that Aspose.Total pulls in -->
    <PackageReference Update="Aspose.Slides.NET"
                      ExcludeAssets="all"
                      PrivateAssets="all" />

    <!-- Bring in the cross‑platform assembly -->
    <PackageReference Include="Aspose.Slides.NET6.CrossPlatform" Version="25.2.0" />

    <PackageReference Include="DotNetEnv" Version="3.1.1" />
    <PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
  </ItemGroup>
</Project>

With this, I still get the same System.Drawing.Common is not supported on non-Windows platforms error.

  • Approach 2: I replaced the Aspose.Total package with Aspose.Words package and Aspose.Slides.NET6.CrossPlatform, both at v25.2.0. Running the project in docker container, I get following error:

Unhandled exception: System.TypeInitializationException: The type initializer for ‘’ threw an exception.
—> System.PlatformNotSupportedException: linux-arm64, Arm64
at .(String , Assembly, Nullable`1 )
at System.Runtime.InteropServices.NativeLibrary.LoadLibraryCallbackStub(String libraryName, Assembly assembly, Boolean hasDllImportSearchPathFlags, UInt32 dllImportSearchPathFlags)
at .d(Int32 d, Int32 v, Int32 c, IntPtr& t)
at System.Drawing.Bitmap…ctor(Int32 width, Int32 height, PixelFormat format)
at System.Drawing.Bitmap…ctor(Int32 width, Int32 height)
at …cctor()
— End of inner exception stack trace —
at …ctor(Presentation )
at tor(TextFrame )
at Aspose.Slides.TextFrame…ctor( )
at Aspose.Slides.AutoShape()
at.(Presentation )
at resentation )
at Aspose.Slides.Presentation…ctor(LoadOptions loadOptions)
at Aspose.Slides.Presentation…ctor()

Looks like this issue was previously logged Does Aspose.Slides for .NET Support ARM? and an update was added in v23.9. Any idea why I would be getting this error?

  • Approach 3: My project file has the following content:
<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>net8.0</TargetFramework>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Aspose.Total" Version="25.2.0">
      <Aliases>SlidesClassic</Aliases>
    </PackageReference>
    <PackageReference Include="Aspose.Slides.NET6.CrossPlatform" Version="25.2.0">
      <Aliases>SlidesCrossPlatform</Aliases>
    </PackageReference>

    <PackageReference Include="DotNetEnv" Version="3.1.1" />
    <PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
  </ItemGroup>
</Project>

With this, I still get the same System.Drawing.Common is not supported on non-Windows platforms error.

Atleast with Approach 2, I have a different error, so that looks promising. Let me know your thoughts on this.

Thank you.

@sudi.karmacharya,
I’ve reproduced the issues you described. We are sorry that you encountered these problems.

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-44926

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.

@andrey.potapov, thanks for confirming.

Just for my understanding, were you able to replicate all of the issues?

I understand time estimation is not included in free support services. Just want to get your thoughts on the issue. Does this seem like it can be resolved quickly, or would it be more of a feature change? Understanding the severity of these issues might be helpful in recalibrating the timeline on our end or possibly finding an alternative.

Out of curiosity, are these issues associated with one particular version? Is there a version where these issues may not come up?

@sudi.karmacharya,
Thank you for your questions. Yes, I replicated all the issues you described. Our developers have started to investigate the case.

The Dockerfile you provided uses a universal base image.

FROM debian:10

This is a generic image that supports multiple architectures, depending on how it’s pulled or built.
Could you please specify which architecture was used to build this Docker image and which host OS it was executed on?
This information will help us identify a possible solution to the issue.

Thanks for the quick reply, @andrey.potapov .

I added a platform info in the docker file for linux/amd64. The host OS would be OSX, Sonoma 14.6.1 on an ARM-based arch.

Just an FYI (not sure if this changes anything on your end), I tried approach 2 with linux/amd64 in dockerfile. This generates a new error. See below:

Unhandled exception: System.TypeInitializationException: The type initializer for 'hrew an 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 using a tool like strace. If you're using glibc, consider setting the LD_DEBUG environment variable: 
/usr/share/dotnet/shared/Microsoft.NETCore.App/8.0.14/libaspose.slides.drawing.capi_x86_64_libstdcpp_libc2.23.so: cannot open shared object file: No such file or directory
libfontconfig.so.1: cannot open shared object file: No such file or directory
/usr/share/dotnet/shared/Microsoft.NETCore.App/8.0.14/liblibaspose.slides.drawing.capi_x86_64_libstdcpp_libc2.23.so: cannot open shared object file: No such file or directory
/application/app/DocumentService/bin/Release/net8.0/liblibaspose.slides.drawing.capi_x86_64_libstdcpp_libc2.23.so: cannot open shared object file: No such file or directory
/usr/share/dotnet/shared/Microsoft.NETCore.App/8.0.14/libaspose.slides.drawing.capi_x86_64_libstdcpp_libc2.23: cannot open shared object file: No such file or directory
/application/app/DocumentService/bin/Release/net8.0/libaspose.slides.drawing.capi_x86_64_libstdcpp_libc2.23: cannot open shared object file: No such file or directory
/usr/share/dotnet/shared/Microsoft.NETCore.App/8.0.14/liblibaspose.slides.drawing.capi_x86_64_libstdcpp_libc2.23: cannot open shared object file: No such file or directory
/application/app/DocumentService/bin/Release/net8.0/liblibaspose.slides.drawing.capi_x86_64_libstdcpp_libc2.23: cannot open shared object file: No such file or directory

   at System.Runtime.InteropServices.NativeLibrary.LoadLibraryByName(String libraryName, Assembly assembly, Nullable`1 searchPath, Boolean throwOnError)
   at .(String , Assembly, Nullable`1 )
   at System.Runtime.InteropServices.NativeLibrary.LoadLibraryCallbackStub(String libraryName, Assembly assembly, Boolean hasDllImportSearchPathFlags, UInt32 dllImportSearchPathFlags)
   at .d(Int32 d, Int32 v, Int32 c, IntPtr& t)
   at System.Drawing.Bitmap..ctor(Int32 width, Int32 height, PixelFormat format)
   at System.Drawing.Bitmap..ctor(Int32 width, Int32 height)
   at ctor()
   --- End of inner exception stack trace ---
   at tor(Presentation )
   at tor(TextFrame )
   at Aspose.Slides.TextFrame..ctor )
   at Aspose.Slides.AutoShape()
   at .(Presentation )
   at .(Presentation )
   at Aspose.Slides.Presentation..ctor(LoadOptions loadOptions)
   at Aspose.Slides.Presentation..ctor()

I have Aspose Words and Aspose.Slides.NET6.CrossPlatform packages in the project file.

Thank you.

@sudi.karmacharya,
Thank you for the additional information. I’ve forwarded it to our developers.

@andrey.potapov, I tried the solution listed in Unable to Load Shared Library ‘libaspose.slides.drawing.capi_x86_64_libstdcpp_libc2.23’ - #8 by andrey.potapov. Adding the libraries listed

libfontconfig1 \
libfreetype6 \
libexpat1 \
libpng16-16

resolved the issue for approach 2.

However, I am facing another issue - this one is regarding the metered license.

I have metered license set for Words and Slides in the same file.

using WordsMetered = Aspose.Words.Metered;
using SlidesMetered = Aspose.Slides.Metered;

public static void SetAsposeWordsMeteredLicense()
    {
         ......
        // public and private keys set to string variables using env variables
         WordsMetered wordsMetered = new WordsMetered();
         wordsMetered.SetMeteredKey(publicKey, privateKey);
    }

public static void SetAsposeSlidesMeteredLicense()
    {
         ......
        // public and private keys set to string variables using env variables
         SlidesMetered slidesMetered = new SlidesMetered();
         slidesMetered.SetMeteredKey(publicKey, privateKey);
    }

I get the Authentication failed error only for Aspose slides. Just to experiment, I set keys only for Aspose Slides in this file, and the authentication still fails.

How do I go about and fix this?

Thank you.

@sudi.karmacharya,

Thank you for the information. I’ve forwarded it to our developers.

Please follow the instructions below to send us your metered license keys. We will check it as soon as possible.
How to Send License File to Support Team

I’ve sent the keys privately. Let me know if you are able to see it on your end.

@sudi.karmacharya,
I’ve received your license keys. If I understand you correctly, the license keys are for Aspose.Total. Could you please confirm this?

Yup, the license keys are for Aspose.Total, @andrey.potapov

@sudi.karmacharya,
Thank you for the confirmation. I’ve reproduced the problem with the license keys.

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-44935

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.

@sudi.karmacharya,
Could you please share the Order ID? We will try generating new keys for you.

Hi @andrey.potapov, is the issue with the keys?

Would the regeneration invalidate the existing keys? Would you like me to send it over privately?

Thanks,
Sudi

@sudi.karmacharya,
Unfortunately, I cannot answer your questions yet. We need to check your current order first. You can send it to my email.

Where can I find your email, @andrey.potapov ?