Installing a Grasshopper plugin for Rhino 6 or Rhino 7 only

Is it possible to install a Grasshopper plugin such that it will only be loaded by Grasshopper in Rhino 6 or Rhino 7?
We would like to distribute different versions of our plugin for Rhino 6 and Rhino 7, because of new features available only for Rhino 7.

Hey @snabela, there are two ways that you could do this…

  1. Use the package manager!

    Each version of a package can have multiple “distributions”, where a distribution targets a specific platform and/or version of Rhino. When users search for your package, they’ll only be able to download versions which have distributions compatible with their platform and Rhino version. See the docs for more info and let me know if anything is unclear!

  2. Alternatively, check the Rhino version when your plug-in loads. Something like…

    public class MyAssemblyPriority : Grasshopper.Kernel.GH_AssemblyPriority
    {
        public override GH_LoadingInstruction PriorityLoad()
        {
            if (Rhino.RhinoApp.Version.Major == 7)
            {
                return GH_LoadingInstruction.Proceed;
            }
            else
            {
                // TODO: display message to user
                return GH_LoadingInstruction.Abort;
            }
        }
    }
    
1 Like

Many thanks for this hint @will! We want to support parallel installations for Rhino 6 and Rhino 7, I guess this means we should choose option 2, did I understand this correctly?

Both options will work in this scenario. Packages are installed separately for each version of Rhino. If you look at the API entry for PanelingTools, you can see the different distributions for Rhino 6 and 7 – https://yak.rhino3d.com/versions/panelingtools/2018.12.17.906.

The advantage of using the package manager here is that the compatibility is checked when the user tries to install the plug-in, rather than at runtime.

One disadvantage is that in Rhino 6 the package manager is hidden behind a test command (_TestPackageManager) and it uses an old version of the UI.

I have tried this option, but found that Grasshopper asks which plugin to load beforehand:

image

I am trying to achieve a setup where I can have two versions of the plugin installed: One that get’s loaded by Grasshopper in Rhino 6, another one that gets loaded by Grasshopper in Rhino 7. Is that possible at all?


Addition:
Just tried what happens when renaming one of the plugins. The initial popup doesn’t show up as expected, but Rhino 6 will still try to load the version of the plugin which was built against Rhino 7, completely forgot about that :sweat_smile:

Seems like we are getting closer to a solution. Is there a way to configure plugins to be loaded from different locations for Rhino 6 and Rhino 7, e.g. by means of .ghlink files?