Can't find C# Grasshopper component in Visual Studio when starting Rhino

Hi all,

Normally when starting a custom made component in Rhino, you can find it in the assigned map. For example in Maths under Script with an image like below:
This is the first time I used Visual Studio (2017) on Windows (instead of Mac) and my problem is when I start Rhino I can’t find the custom component. Does is work differently on Windows?

Can someone please help me out?

Thanks a lot in advance for any help!
Kind regards,

Icons may be on the dropdown portion of a panel only, or even hidden altogether depending on their exposure. What is the Exposure property set to in Visual Studio?

Thanks for the quick response!!! Do you mean the GH_Exposure override? This is what it’s set to now:
get { return GH_Exposure.primary; }

Yep that one. Primary means it should be visible in the first panel section whenever possible. So the fact that it’s not means one of the following:

  1. The component isn’t loaded at all (is it? I can’t tell from here)
  2. The component is forced into the dropdown due to lack of space (is it? I can’t tell from here)
  3. The tab+panel layout is overridden by a custom layout scheme. This feature was removed in GH for Rhino6, but is still in GH for Rhino5.

Can you confirm (1) and (2) are not the issue here?

(1) and (2) are not the issue! If (1) means that while starting Rhino errors pop up. I am using Rhino 6, but Visual Studio 2017 (don’t know if that makes a difference)! How can I fix this?

Hi David! I was wondering if you can help me further with my problem?

Maybe. Maybe just a mention in the command line. Maybe nothing if Grasshopper thinks it somehow isn’t supposed to load it. The point is you should be able to use the component if it’s loaded.

Does it show up when you search for it from within the double-click popup? You can instantiate a component by dragging text which represents the ComponentID onto the canvas.

If neither of those things work, the most likely explanation is that the component isn’t getting loaded. Are you hitting breakpoints in Visual Studio during debugging that would indicate Grasshopper is loading your plug-in assembly?

The component doesn’t show up… So it isn’t loading. I’m not using any breakpoints during the debugging. How can I get it to load?

Thank you so much for the help btw!!

These are the usual things that need to happen if you want to Debug a plug-in assembly using Visual Studio:

  1. VS needs to output a file called <MyPluginName>.gha instead of <MyPluginName>.dll. The plugin wizards will usually take care of this, but if that’s not working you need to set up a post-build event by hand to rename the dll file.
  2. This gha file will by default be in either the \bin\Debug\ or bin\Release\ folder. I actually don’t like having two versions of the same project next to each other with different states, so I change my build flavour output directory to just be \bin\ for both Debug and Release builds. I do not know if the VS wizards also sets this up this way.
  3. Now when you build/compile your project you should get a new <MyPluginName>.gha file somewhere inside \bin\? with a current timestamp.
  4. Next up Grasshopper needs to learn that it is supposed to load this gha file. The easiest way to set this up is to run the _GrasshopperDeveloperSettings command in Rhino and add your bin folder to the list of folders in which Grasshopper looks:
  5. Also make sure that Memory Load *.GHA... is unchecked, or breakpoints won’t work.
  6. Lastly, you must make sure that when you begin debugging, Visual Studio knows that it’s supposed to start Rhino. This is taken care of by the wizard, but you can also set the start action via the VS UI:

You should now be set to debug your project. Put a breakpoint on the first line of the constructor of your component and start the debugger. Rhino should load. Run the _Grasshopper command and your breakpoint should turn from an open circle into a closed disk once your plugin gets loaded. It should also hit the breakpoint as all components are constructed once during load.


I followed all the steps and now it works! Thank you so much!!!