We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

(Runtime)Exception in .Net Standard 2.0 Library (referenced by .Net Framwork 4.6.1) (Aspose.Cell)

An Exception occurs if you try to access a Project using Aspose.Cell and .Net Standard 2.0 Library from a Project using .Net Framwork 4.6.1

To reproduce:

  • Create a .Net Standard 2.0 Library Project and add Aspose as a Reference

  • Create a Class (MyTestClass.cs) and use Aspose somehow. e.g. add this line in the Constructor “License license = new License();”

  • Create a second Project (ConsoleApp .Net Framwork 4.6.1)

  • Reference the .net Standard Library.

  • Generate an Instance of “MyTestClass.cs

Now the Exception occurs at runtime, as soon as the Constructor is called.

(Info: No Exception occurs if you access the same Standard2.0 Library from a Console-.NETCore-Project.)

Thank you for your query. I have created the second project with the specified configuration but could not observe any issue. Please share your simplest solution containing both the projects with us for our testing. We will analyse the issue here and provide assistance at the earliest.

Hi @ahsaniqbalsidiqui,
thank you for your reply.

I could not find a way to upload files here. So I uploaded it to the following bin (available for the next 7 days).

It contains a zipped VisualStudio 2017 Solution with 3 Projects:

  • ClassLibrary_NetStandard (The library using Aspose)
  • ConsoleApp_NetFrameWork461 (A NetFrameWork461 project, Calling the NetStandard-Library)
  • ConsoleApp_netCore (A netCore project, Calling the NetStandard-Library)

Starting the ConsoleApp_NetFrameWork461 (Program.cs) yields the following exception

Message=Die Datei oder Assembly “Aspose.Cells, Version=, Culture=neutral, PublicKeyToken=716fcc553a201e56” oder eine Abhängigkeit davon wurde nicht gefunden. Das System kann die angegebene Datei nicht finden.
at ClassLibrary_NetStandard.MyNetStandardClass…ctor() in C:\AsposeCellsSolutionTest\ClassLibrary_NetStandard\MyNetStandardClass.cs:line 14
at ConsoleApp_NetFrameWork461.Program.Main(String[] args) in C:\AsposeCellsSolutionTest\ConsoleApp_NetFrameWork461\Program.cs:line 16

Starting the ConsoleApp_netCore Yields no exception and works as expected.

We were able to observe the issue but we need to look into it more. We have logged the issue in our database for investigation and for a fix. Once, we will have some news for you, we will update you in this topic.

This issue has been logged as
CELLSNET-46975 – Runtime Exception in .Net Standard 2.0 Library (using Aspose.Cells) referenced by .Net Framwork 4.6.1


We have analysed the issue in detail and would like to share that if you need to use Aspose.Cells in a .Net project, we suggest using Aspose.Cells .Net version directly.

For this issue, we performed following tests:
Open ClassLibrary_NetStandard, remove the reference of Aspose.Cells from nuget, add System.Text.Encoding.Codepages from nuget.
Open MyNetStandardClass.cs, try this code:


This is a initialization method which should run on .NetStandard environment.
Then we run ConsoleApp_NetFrameWork461, but will also fail. (can not find System.Text.Encoding.CodePages)

We guess: “Net461 lib -> NetStandard lib -> Nuget package”, this sequence make it confuse for compiler to get the correct nuget lib,
if you open the folder “.nuget\packages\system.text.encoding.codepages\4.4.0\lib”,
you will see “net461” and “netstandard2.0” version, but which should be used?
Then we add “netstandard2.0\System.Text.Encoding.CodePages.dll” manually to ClassLibrary_NetStandard, it runs without errors.

But we are afraid this way can not solve this problem, because Aspose.Cells .NetStandard version needs to refer “System.Drawing.common”.
“System.Drawing.common” can not run correctly under this condition, even you refer it manually.

Feel free to contact us at any time if you need further help or have some other issue or queries, we will be happy to assist you soon.