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.
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.
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):
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.