Site Tools


Rhino_DotNet-based Plug-in Compatibility

Making your Rhino_DotNet-based plug-in compatible with the Rhino Installer Engine

The Rhino Installer Engine provides a simple way to distribute plug-ins for Rhino 4.0, Rhino 5 32- and 64-bit. To learn more about distributing plug-ins using the Rhino Installer Engine, read About the Rhino Installer Engine.

Note: This information pertains to plug-ins built with the legacy Rhino_DotNet SDK. This information does not apply to plug-ins built with RhinoCommon.

Discussion

Plug-ins created with the Rhino 4.0 and early 5.0 .NET plug-in wizard had a GUID in the AssemblyInfo file that did not match the plug-in GUID. You need to make these two GUIDs match, or the RhinoInstallerEngine will not work properly. Also, the AssemblyInformationalVersion attribute must be added with a value of 2. This is a hint to the RhinoInstallerEngine that you've done the work to make the GUIDs match.

Changes to AssemblyInfo.cs

GUID

Make sure the Guid attribute matches the GUID in the PlugInID override in your RMA.Rhino.MRhinoUtilityPlugIn derived class:

  // Ensure this GUID matches the one in MyPlugIn::PlugInID()
  [assembly: Guid("adc7305a-9b8a-477b-8b48-ecafa9c515ad")]

Title

Ensure that your plug-in title is correct in:

  [assembly: AssemblyTitle("My Plugin Title")]

This is the title that will be used to show what plug-in is being installed.

AssemblyInformationalVersion

Add AssemblyInformationalVersion attribute:

  [assembly: AssemblyInformationalVersion("2")]

Be sure the value is “2”. See discussion above.

Changes to MyPlugIn.cs

GUID

To reduce the possibility of GUID mismatch, change the PlugInID() function to return your plug-ins GUID attribute:

  public override System.Guid PlugInID()
  {
    System.Reflection.Assembly a = System.Reflection.Assembly.GetExecutingAssembly();
    object[] idattr = a.GetCustomAttributes(typeof(System.Runtime.InteropServices.GuidAttribute), true);
    System.Guid id = new System.Guid(((System.Runtime.InteropServices.GuidAttribute)idattr[0]).Value);
    return id;
  }

Title

To reduce the possibility of Title mismatch, change the PlugInName() function to return your plug-ins AssemblyTitle attribute:

  public override string PlugInName()
  {
    System.Reflection.Assembly a = System.Reflection.Assembly.GetExecutingAssembly();
    object[] idattr = a.GetCustomAttributes(typeof(System.Reflection.AssemblyTitleAttribute), true);
    string name = ((System.Reflection.AssemblyTitleAttribute)idattr[0]).Title;
    return name;
  }

PlugInVersion

To reduce the possibility of PlugInVersion mismatch, change the PlugInVersion() function to return your plug-in's AssemblyVersion attribute:

  public override string PlugInVersion()
  {
    System.Reflection.Assembly a = System.Reflection.Assembly.GetExecutingAssembly();
    string version = a.GetName().Version.ToString();
    return version;  
  }

Tags:

developer/rhinoinstallerengine/dotnet.txt · Last modified: 2016/03/17 by sandy