Cannot import custom C# library into GH scripting components

Hello everyone!

I’m currently converting a large Grasshopper script into a C# library to improve scalability and (potentially) enable collaboration in the future. My goal right now is to make a custom library and then make GH scripting components that inherit this library - I’m using the Script Editor for now.

However, I can’t get the script component to see my custom library. Below is some pseudocode of what I’m working with, as well as an image of the script editor layout. Any help would be appreciated.

// In the "CH_Library" folder, named "Assembly.cs"

namespace CH_Library.SubLibrary{
// Some public classes and enums...
}

// In the GH script component, visible in the same editor, under "Components/"

using CH_Library;
using CH_Library.SubLibrary;

// Code that implements the CH_Library...

Thanks in advance,
CH

Try Visual Studio for library dependency and integration.
Native Script Editor is not meant for such things.

Got it, thanks! Will transfer develop towards VS.

@Cole_Howell1

During development of a Grasshopper component that needs a library, Shift+Right-Click on the component and enable the library input and pass the path of the library into it.


This parameter is ignored when the component is published and the compiled library will be injected into the component when the published plugin is loaded in Grasshopper

1 Like