C# component in multiple GH files: how to keep updated?

Hi everyone,

I’ve created a custom C# component that I’m using across multiple Grasshopper scripts. I’d like to know the best way to update this component automatically in all scripts if I make changes to it in the future.

Also, other people in my company will be using this component, so I’m looking for a way to make sure they also get the latest version easily.

Would the simplest solution be to create a package using the Package Manager and have it installed on all the computers that need the component?

Alternatively, if I don’t want to use the Package Manager, would it be possible to save the component as a .ghuser file, place it in the UserObjects folder on each user’s machine, and then use a C# script to reference or load that .ghuser file somehow? Is that even doable?

I’d really appreciate hearing about your experiences or any suggestions you have.

should be easiest to save the scriptfile on harddrive and feed its filepath to the script input of the script node.
(Shift + RMB click)

It does not work because of the ScriptInstance Implementation:

If this is not a reason for a precompiled plugin, then I don’t know… Scripts are fine for most cases, but when you share code and you want to update it, then the only sane way would be to write a custom plugin.

2 Likes

ok.
I still need to adjust the node manualy when input or output variables change
AND I am using a plugin (wombat) AND it´s python…

perhaps did´nt understand your question?

I’m not sure if the new script editor has a code property one can overwrite yet, but if/when it does one might use a workflow similar to this old GhPython one (i.e. where we write/read/overwrite scripting component source code based on an explicit naming/versioning scheme):

But also, what @TomTom said :wink:

That’s what I tried, but it doesn’t work if your code uses the scriptinstance function. From what I understand, this method only supports basic operations. If you need to call Grasshopper-specific functions, it won’t work.

Thanks @TomTom and @AndersDeleuran I will try that, thanks! :slight_smile: