Determine whether a plugin is loaded from Rhino 4 or 5 with Rhino.NET


#1

Hi,

Because I need to maintain a legacy Rhino.NET plugin on both Rhino 4 and 5, I need to determine whether it is running inside version 4 or 5.

All I can find is in the IRhinoApp interface:

  • GetApplicationName
  • GetBuildDate

Does anyone has something more reliable than using one of these two methods ?


(Menno Deij - van Rijswijk) #2

It seems that the ExeVersion that can be used in RhinoCommon and in C++ is lacking from Rhino_DotNet. I think that analysing the registry key is the most reliable after that.

MRhinoApp app = RMA.Rhino.RhUtil.RhinoApp();

string reg = String.Empty;
if (app.GetRhinoRegistryKey(ref reg))
{
    app.Print(reg + Environment.NewLine);
               
    string version = reg.Substring(reg.LastIndexOf('\\') + 1);
    app.Print(version + Environment.NewLine);
}

In that string you should get 4.0, 5.0 or 5.0x64