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

Free Support Forum - aspose.com

Installing Aspose.Cells for .NET Core v19.3 from NuGet package manager - Exception "Could not load file or assembly 'System.Drawing.Common'"

Hi,

I just upgraded from Aspose.Cells 19.1.0 to 19.2.0 and ran my unit tests. I get the following error from Aspose.Cells:

System.IO.FileNotFoundException : Could not load file or assembly 'System.Drawing.Common, Version=4.0.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.
   at Aspose.Cells.WorksheetCollection.\u000f()
   at Aspose.Cells.WorksheetCollection.\u0005(Int32 \u0002)
   at Aspose.Cells.Workbook..ctor(FileFormatType fileFormatType)
   at ... my code

The release notes for 19.2.0 do not mention any new dependency: https://docs.aspose.com/display/cellsnet/Aspose.Cells+for+.NET+19.2+Release+Notes

Reverting back to Aspose.Cells 19.1.0 fixes the error. My project is a .NET Core 2.2.102 project.

Any idea why this dependency is requested now?

Thanks,

dstj.

@dstj,

Thanks for the query.

I have tried this scenario in my sample project but could not observe this issue with the latest version
Aspose.Cells v19.2.0. Please share a simplest project (runnable solution) which can be used here for reproducing this issue. We will analyze this problem using your sample project and provide our feedback.

@ahsaniqbalsidiqui, really?

Because just creating the Workbook() crashes for me. Can’t get any simpler than that:

using Aspose.Cells;

namespace AsposeCellBug
{
  class Program
  {
    static void Main(string[] args)
    {
      var workbook = new Workbook();
    }
  }
}

Here’s the .csproj:

<Project Sdk="Microsoft.NET.Sdk">

    <PropertyGroup>
        <OutputType>Exe</OutputType>
        <TargetFramework>netcoreapp2.2</TargetFramework>
    </PropertyGroup>

    <ItemGroup>
      <PackageReference Include="Aspose.Cells" Version="19.2.0" />
    </ItemGroup>

</Project>

And the error message:

Unhandled Exception: System.IO.FileLoadException: Could not load file or assembly 'System.Drawing.Common, Version=4.0.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
   at Aspose.Cells.WorksheetCollection.()
   at Aspose.Cells.WorksheetCollection.(Int32 )
   at Aspose.Cells.Workbook..ctor(FileFormatType fileFormatType)
   at AsposeCellBug.Program.Main(String[] args) in C:\dev\scrap\AsposeCellBug\AsposeCellBug\Program.cs:line 9

@dstj,
Here a fresh project is attached which is just creating an instance of workbook without any error. Please download it and try at your end.

@dstj,

We have investigated the issue more and observed that you are right that these dependencies are required now with v19.2.x, however these were not required in v19.1. You may please add System.Drawing.Common from the NuGet package manager to resolve this issue.
In some cases you may also require System.Text.Encoding, however while using NuGet package manager, it automatically fetches all the required dependencies based upon the API calls used in the application.

We are sorry for the inconvenience caused to you in this regard.

Following is a sample project for your reference:
TestDotNetCoreProj.zip (349.8 KB)

@ahsaniqbalsidiqui

Glad to hear that I’m not crazy :wink:
The Release Notes should mention extra dependencies like that. It’s a “breaking” change (i.e. we need to change something more than just update)

Thanks.

@dstj,

on the page, please click on “Dependencies” node after “Release Notes” to see the dependencies for .NET Standard for your reference.

Well, 19.1.0 has System.Drawing.Common too listed as dependency on the NuGet package page yet it does not crash without it: https://www.nuget.org/packages/Aspose.Cells/19.1.0 (I’m guessing that it was only actually used when using Graph or Charts)

So that wouldn’t have helped much, but I was taking about the official Release Notes page here: https://docs.aspose.com/display/cellsnet/Aspose.Cells+for+.NET+19.2+Release+Notes

@dstj,
Well you are right that dependency is there when graphs or charts are processed in the newer version. Regarding its information in the release notes, these notes contain information about bugs, enhancements and exceptions which are reported by users. Similarly these release notes contain the deprecated calls and any changes in syntax or new API calls. As this specific change of dependency under discussion does not lie under any of these sections, so it is not there.

Hope it clarifies the query.

Adding reference to System.Drawing.Common 4.5.0 as nuget manually is not solving the problem.
Project is netstandard2.0 and we use Aspose.Cells 19.3.0 and still get error message:
System.IO.FileLoadException: Could not load file or assembly 'System.Drawing.Common, Version=4.0.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

Dependencies for Aspose.Cells say they need version 4.5.0 of System.Drawing.Common, but the error messages seems like it looks for version 4.0.0.

@torstenmandelkow,
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

CELLSNETCORE-24 - Issue while installing Aspose.Cells for .NET Core v19.3 from NuGet package manager

@torstenmandelkow,

Please manually install System.Drawing.common 4.5.1 after installing Aspose.Cells 19.3.0 as a temporary way to solve the exception. We will fix this problem in Aspose.Cells 19.4.0.

@torstenmandelkow,

Please install Aspose.Cells 19.4.0 from nuget, this problem has been fixed now.