Hello all - sorry if this is a bit incoherent, I’m new to certain aspects of software development.
I’m trying to use NPOI 2.7.3 in RhinoCommon for a plugin I’m developing, but the exception below is thrown when initializing an XSSFWorkbook:
FileLoadException: Could not load file or assembly ‘ICSharpCode.SharpZipLib, Version=1.4.2.13, Culture=neutral, PublicKeyToken=1b03e6acf1164f73’.
Which is odd, as SharpZipLib is loaded according to VisualStudio. Thing is the implementation works fine in Grasshopper’s C# script when imported as an #r directive using the same package version and as a standalone program - only when run as a plugin do I encounter problems.
So I’m wondering if there’s something I’m missing. Do I need to import NPOI some other way? Do packages need to be installed a certain way to function in Rhino? Any help would be appreciated.
I’m using NuGet package manager for the packages, and can provide images or code snippets if necessary.
~CH
Which version of .net are you targetting (see your .csproj file) and which version is Rhino running(see setdotnetruntime command)? possibly there is a conflict there.
Thanks for the reply, sorry for the delay in response.
I just checked and I was targeting both net48 and net7.0, and my Rhino project was set to NETCore 8.0.14. I did some testing and tried changing Rhino’s dotnet runtime to v7, tried changing from NETCore to the NETFramework, and changing the targeted framework to be just what Rhino was using. I’m still getting the same exception thrown with the same specs.
While the issue itself is still unsolved, I found switching from XSSFWorkbook to HSSFWorkbook allows the plugin to work because it avoids using the unloaded SharpZipLib. XSSFWorkbooks would be ideal in my use case because of how much data we’re expecting to store, but this will work in the meantime.
TL;DR - if you’re running into the same problem I am, switch from XSSFWorkbook to HSSFWorkbook and update the used packages accordingly.
1 Like