Loading Grasshoper component as .dll

Dear all,

I tried googling a bit but I only find results from 2011.

Can I include my Grasshopper components in my Rhino plugin dll and then load it to grasshopper?

I want to have less files possible!

Hope to find a positive answer!

What we typically do is to have the (common) functionality in a shared DLL, and to expose the functionality as a Rhino command in an RHP, and as a Grasshopper component in a GHA.

Hi menno,

Thank you for the reply.

What I want is to have one only dll with rhino plugin and grasshopper components to have less files to install and making updates easier. What you propose unfortunately is the opposite as it adds more files! But ok I can live with that and keep rhp and gha.

New question: I can’t manage to reference the plugin as rhp in the grasshopper project, only as dll.
Visual studio refuses the rhp. Any advise on how to do that?

Many thanks!

Mikael

You need to add your compiled plugins (RHP or GHA) to a zip archive and change the extension from .zip to .rhi . Once this is done, you can double-click the archive and the Rhino Installer Engine will begin to install your plugins.

It’s the way lots of plugins like PanelingTools install:

It’s an issue from VS. I’d recommend use DLL in VS IDE. And use AppDomain.AssemblyResolve in a production env, to find references to RHP files.

edit: Only when you want to reference RHP. Better if you can refactor your library and don’t need to do so.

What I meant is this:

GHA ---> DLL <--- RHP

You have 3 files: 1 DLL with shared functionality, 1 RHP with Rhino commands, and 1 GHA with Grasshopper components. No need to use AssemblyResolve.

What you said is clear but as I said I do not want to increase the file count.

I just want to know if I can load grasshopper components with a .dll instead a .gha
Is it possible at all?

second question:
@gankeyu I’m not sure how to do that. Any more hints?

but as I said I do not want to increase the file count.

Fine. Tuning out.