How to fetch the dependencies that the open GH script has using C#

Hey guys,

How can I fetch the dependencies that the current opened GH script has?
I need to do this using C#.

I tried to see if the “GH_Document” had some dependencies list that could be filled automatically, but could not do it.

Any help would be appreciated.

Thanks,
Ricardo

Do you mean add more (using) dependencies?
Here you can do it.

No, I mean when you make a grasshopper script sometimes you add some blocks to your canvas that have “dependencies”.
I need to list all the dependencies from the current GH script so that when giving the script to other person, that person knows which things he must install.

If you are referring to the plugins that the document uses, you can use:

Grasshopper.Instances.ComponentServer.FindAssemblyByObject(documentObject);

to access to its GH_AssemblyInfo and get some info from there. If you want to go deeper, you can use the Assembly property and the Assembly.GetReferencedAssemblies method.

GH already does that :v And I’m not sure you can read components that the user doesn’t have installed from a scripting component.

Yes, you cannot read components without installing the needed things, however, my use case is:

Current user wants to share a GH_Script, then my code must understand what dependencies that shared script has so that user number 2 that might want to use the script has a list of the dependencies he must install.

I am guessing GH_Assembly “Name” is enough for my case.
Normal components seem to have this name as Grasshopper, then I can ignore those, others seem to have right names, like “Kangoro”, “GH_Sofistik”, “Karamba” etc

Again, GH already does that.