I’ve added a reference to a library called itextsharp (for generating PDFs) to my GHA.
When I run my add-in, it throws this error:
Solution exception:Could not load file or assembly ‘itextsharp, Version=5.5.13.0, Culture=neutral, PublicKeyToken=8354ae6d2174ddca’ or one of its dependencies. The system cannot find the file specified.
The itextsharp.dll library is saved in the bin folder of my solution. I installed it via NuGet.
Did I do something wrong?
Hi Dave. Happy new year!
I believe it is loaded from disk.
I compile my .GHA in Visual Studio and save it in the …\AppData\Roaming\Grasshopper\Libraries folder.
Then it is loaded when Grasshopper loads, I suppose.
Grasshopper can load plugins in two ways, and the sequence of decisions that lead to either of these is very complicated, although the default is to load from disk. You can tell by looking at the plugin details once Grasshopper has started. Open up the About dialog, click on the little plus icon in the top left corner, double-click on your plugin icon and look at the loading details.
Other question, is the pdf dll file unblocked in Windows?
No. Ideally you wouldn’t use COFF loading. You probably have the checkbox in the _GrasshopperDeveloperSettings command enabled. That shouldn’t be the case.
You can add an assembly attribute to your plugin informing Grasshopper how you want to load your plugin (I can’t give you an example now, on an iPad).
Or you can handle the framework assembly resolver event and load your pdf dll through code.
I have a similar problem. I created a custom class/object and call them from the c# grasshopper component for debugging using “Manage from external libraries” (where I attach my gha to the component). I did not load anything using GrasshopperDeveloperSettings, already uncheck COFF loading in GrasshopperDeveloperSettings. I receive an error saying my custom class does not exist, even when I already load the latest dll. This is the reported error:
Could not load type ‘FastCode.GetSptnsForPipes’ from assembly ‘FastCode, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null’
(Fastcode is the name of my namespace and gha, GetSptnsForPipes is my custom class/object)
I also notice my previous created class still works fine. However, as long as I called out a recently created class, it will say failed to load. And yes, I already checked, the gha I loaded is built after that class is created. Gha is unblocked too.
This error only appear in Rhino6. All my Rhino5 worked fine
I Have the same problems. I unchecked the COFF in my GrashopperDeveloperSettings and reloaded all my files, all the classes and objects that I created recently in the SCoM.dll can not be loaded and I get the error:
Solution exception:Could not load type ‘SCoM.Construction.Beams.StructuralTimberBeam’ from assembly ‘SCoM, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null’.
Surprisingly, all the old classes that I created in the SCoM are still working. I double checked the SCoM.dll and it is the newest version that I load.
Did you manage to solve the problems? What would you suggest? Really stuck here…