I saw New way to load a C# .net plugin on Rhinoceros Forums and it looked interesting, so I'm trying it out.
The basic idea is as in the following article, but the article is for Rhino commands, so I'm making one for Grasshopper
https://www.codeproject.com/Articles/1091178/Managed-Extensibility-Framework-MEF-Plugin-for-Rhi
Rhino command version here
The original article was published under The Code Project Open License (CPOL) 1.02.
This repository is under MIT License
For more detail, please see the original article.
- Build the solution
- Load GHPluginLoader.gha in GHPluginLoader/bin/ so that the "LoadPlugin" component can be used.
- When you execute the LoadPlugin component, it needs dll path, so refer to the dll file where the component you want to execute is actually written.
- As an example, the csproj to create a Line is GHPluginMakeLine, so refer to the dll file in its bin
- The component described in MakeLine.cs will be executed.
- Normally, Rhino needs to be restarted when the component code is rewritten, but in this case, MEF is used to load dll each time the LoadPlugin component is executed, so there is no need to restart.
- ;DDDDDDDDDDDDDDD