Incompatibility between package manager and .rhi installer

Hi everyone,

We have an issue with our customers that are facing when they install their plugin PackageManager if they installed our former versions of plugin before with .rhi file.

  • After installing by PackageManager, plugins hold in %APPPDATA\Roaming\McNeel\Rhinoceros\7.0\Plug-ins\{PLUGIN}
  • After installing by .rhi installer, plugins hold in %APPPDATA\Roaming\McNeel\Rhinoceros\packages\Plug-ins\{PLUGIN}

It looks like plugin ID conflicts as you can see below image,

image001

After removing everything from AppData and Registry then installing again, problem is solved. But this is a bad experience for us and our customer.

I just want to understand whether this is something known issue for your side or should we handle it somehow (not sure we can handle it gracefully…) ?

Best regards,

-Oğuzhan

Hey @oguzhankoral, I hope you are doing well :blush:.

I tried recreating your scenario, however Rhino kept cleaning up my packages install for some reason? So I can’t say with 100% certainty, but I’d like to help.

You should be able to override the OnLoad method, check if there is already a plugin with that ID loaded, and then you can return LoadReturnCode.ErrorShowDialog and feed out an errorMessage saying the install was a success and to restart rhino.

When the OnLoad is called on the starting of Rhino, you could use this same method with a check to the calling location of the current assembly, and checking for an install in the other directory and return LoadReturnCode.ErrorNoDialog if you don’t want the one in this directory to load. I realised at the end of this, this was messy so I wrote some code.

public class MyRhinoPlugin2Plugin : Rhino.PlugIns.PlugIn
{
      protected override LoadReturnCode OnLoad(ref string errorMessage)
      {
          Guid pluginGuid = Guid.Empty;

          PlugInInfo plugInInfo = PlugIn.GetPlugInInfo(pluginGuid);

          bool choosePackagesInstallIfAvailable = true;

          Assembly assem = typeof(MyRhinoPlugin2Plugin).Assembly;
          if (assem.Location.ToLower().Contains("packages") && choosePackagesInstallIfAvailable)
          {
              if (plugInInfo is object)
              {
                  // This condition should only be hit if we install from Package Manager whilst an existing version is already in Plug-ins
                  errorMessage = "Plugin was installed correctly, please restart Rhino!" +
                      "If you are seeing this message every time you start Rhino, please contact support!";
                  return LoadReturnCode.ErrorShowDialog;
              }

              return LoadReturnCode.Success;
          }

          return LoadReturnCode.ErrorNoDialog;
      }
}
1 Like

Hey @csykes, felt good to hear from you! :slight_smile:

Thanks for your effort!
I tested your suggestion and willing to extend this discussion a bit more.

1- When Rhino installed any plugin at the first time, PlugInInfo returns null, but after every initialization of Rhino, this will return an object which means that your code will jump in to the body of (plugInInfo is object) condition. It will pop-up everytime while Rhino is opening. Am I correct, not sure?

2- Wondering also ID conflict possibly happening because of Eto.Panel ID? @curtisw

3- It seems to me it is a workaround, because it’s McNeel AppData folder, shouldn’t it be handled by Rhino? @dale @will (I tagged you Will because I guess you are the one of the developer of Package Manager?)

Thanks in advance.
-Oğuzhan

1 Like

Hey @oguzhankoral,

I believe that the plugin would not be available via Plugin.GetPluginInfo until after the Plugin is loaded. Which should mean the error message would only show on the condition that a Plugin is already loaded and a new one attempts to be loaded via PackageManager. Happy to be corrected though :slight_smile:

– cs