Reference Custom Rhino Plugin (rhp) from within Custom Grasshopper Component

I’m trying to extend a custom Rhino plugin, by building a suite of grasshopper components in .NET. I want to access commands from the .rhp from within my code. I’ve tried using Rhino.RhinoApp.GetPlugInObject, but it’s kicking back errors.

    protected override void SolveInstance(IGH_DataAccess DA)
    {
        object otto = RhinoApp.GetPlugInObject("Grasshopper");
    }

Error:

GetPlugInObject The name ‘GetPlugInObject’ does not exist in the current context

My error appears to be likely fundamental, but I’m not familiar enough to resolve it. GetPlugInObject indeed does not exist in the Rhino.RhinoApp namespace I have loaded. However, when I edit/compile my code, it autocompletes and doesnt show any errors. Any idea why this might be?

You may need to target the solution to .NET 4.0. Other than that, I do fetch a reference to the VRay-Plugin via GetPlugInObject(GUID) in Scarab. Compiles and works like a charm.

Getting the plugin by name might cause problems. Rhino doesn’t ensure uniqueness of names. There are cases where users had several versions of the same plugin installed. Same name, but different GUID. So if you want to make sure, the installed plugin has the functionality, you want, better use the GUID