I have an asp net core web app with .NET7 that uses the freespire.xls library to manipulate excel files, now I'm migrating this web app to linux but unfortunately when I try to generate a file I get the error:
'Spire.Xls.Core.Spreadsheet.XlsPageSetupBase' threw an exception.
which seems to be due to some dependencies not compatible with linux (like GDI+), do you know a workaround for this problem? I have already tried various solutions like wine or manually inserting the SPire.XLS.dll library generated for netstandard2.0 but nothing worked. Thanks in advance for your help.
I have an asp net core web app with .NET7 that uses the freespire.xls library to manipulate excel files, now I'm migrating this web app to linux but unfortunately when I try to generate a file I get the error:
'Spire.Xls.Core.Spreadsheet.XlsPageSetupBase' threw an exception.
which seems to be due to some dependencies not compatible with linux (like GDI+), do you know a workaround for this problem? I have already tried various solutions like wine or manually inserting the SPire.XLS.dll library generated for netstandard2.0 but nothing worked. Thanks in advance for your help.
Share Improve this question asked Mar 13 at 16:11 dshdsh 231 gold badge1 silver badge8 bronze badges3 Answers
Reset to default 0Possible solutions below.(for alpine linux, try corresponding search for your distro)
me@PC: apk search -d spreadsheet
freexl-2.0.0-r0
freexl-dev-2.0.0-r0
gnumeric-1.12.57-r1
gnumeric-dbg-1.12.57-r1
gnumeric-dev-1.12.57-r1
gnumeric-doc-1.12.57-r1
liborcus-0.19.2-r0
liborcus-dev-0.19.2-r0
libreoffice-calc-7.6.7.2-r2
perl-spreadsheet-parseexcel-0.66-r0
perl-spreadsheet-parseexcel-doc-0.66-r0
perl-spreadsheet-xlsx-0.18-r0
perl-spreadsheet-xlsx-doc-0.18-r0
Remove all the dlls from your app and install the following:
Install-Package Spire.XLSfor.NETStandard
Install-Package SkiaSharp.NativeAssets.Linux.NoDependencies -Version 2.80.0
For more details, you can refer to this forum post.
I solved the problem. I write here the procedure that could be useful to someone: first you need to find the netstandard2.0 folder, if you installed the package from nuget you will find it in the directory "C:\Users\your-user\.nuget\packages\freespire.xls\14.2.0\lib\netstandard2.0", if instead you install with the .msi package you will find it in the installation directory, take the Spire.XLS.dll file inside this folder and import it manually into your project (with the reference in VisualStudio) and delete the Spire.XLS package installed from nuget in the project solution, after that install the dependencies:
SkiaSharp >= 1.68.0
SkiaSharp.NativeAssets.Linux.NoDependencies >= 1.68.0
System.Text.Encoding.CodePages >= 4.5.0
System.Security.Cryptography.Xml >=4.5.0
It is important to have the right version of SkiaSharp.
PS Obviously you need to install libc6-dev libgdiplus libx11-dev but you will surely have them if you are running dotnet on linux