How do I install an updated version of a C# plugin?

It doesn’t seem as easy as in R7, I should be able to “build” my latest version and then overwrite the old version? Do I actually have to create a “debug” output?

Here’s the dialog I’m getting:

image

Nothing eh?

What I’m specifically in need of is just instructions on how to update my C# code… which is basically just nothing more than a script.

I don’t like running “debug”, launching Rhino (a new session even if I have one active), and then thereafter going through the process. Maybe I’ve been spoilt with AutoLISP and the ability of making rapid changes. In short, I’m not able to make one small change, recompile, and then test it out without going through a gigantic hassle.

Anyone who’s developing C# care to share their process?

I develop rhino plugins all day in C# on windows, and I can very happily make small changes, let hot reload run on save and everything works nicely (with the usual exceptions). I only have to restart when I change a lambda or delete something that already existed before.

Your error message is telling you that it’s found two versions of your plugin. Likely you built in debug AND release, or you already have it installed from some other source.

Are you creating a Rhino Plugin and debugging it from Visual Studio Keith?

Thanks for replying so quickly!

I’ve encountered exactly what you’ve described: I originally finished up my plugin “on the fly” using Hot Reload, changing things, and rebuilding… worked great.

At this point the plugin is complete. I have my base command working perfectly. I tent to make small changes to my derived classes based on the base command (or base class). At this point the changes are so simple that I know exactly their effect and don’t need to test them out.

If I have to launch VS Studio, load my plugin, run in “Debug”, launch Rhino… so on and so forth… It feels like a lot of work just to update one variable (in this case it’s the size of a leader arrowhead).

I know a few “hacks”, like re-naming my plugin… but that creates a bigger and bigger mess of course.

Sadly, I don’t even know how to remove a plugin from Rhino.

Recompiling woes

If I have to launch VS Studio, load my plugin, run in “Debug”, launch Rhino… so on and so forth… It feels like a lot of work just to update one variable (in this case it’s the size of a leader arrowhead).

In this case, as it is coded you’ll have to do that.

But you could of course expose these variables somewhere so that they can be modified during runtime. You could use a .json config file that you update and the program re-reads on updating. ASP.NET apps do this a lot. Or you could hook into Rhinos Persistent Settings and store values you want to update ‘on the fly’ in there and then you don’t even need VS to make minor adjustments.

Removing Plugins

To remove plugins you can close Rhino, and then delete the .rhp (and ideally the folder it’s in).
They can be in a few places (I’m on a mac so right now so apologies if I’m slightly off in these locations)
%appdata%/McNeel/Rhinocoers/<version>/plug-ins
%appdata%/McNeel/Rhinocoers/packages/<version>

If you don’t know where it is, you can use the PlugIn Manager in Rhino, find your PlugIn in the list and click ‘Open Containing Folder’.

Furthermore

I normally only ever run Rhino through Visual Studio when I test my plugin, do you normally test it without VS attached? You can attach it whilst rhino is running, but hot reload doesn’t work, so the edits can’t be made.

– cs

This will be super helpful because I have quite a lot of junk piling up. I’m sure I can find the folder(s). This alone might solve everything. Thank-you!!!

Up until now I would develop the majority of my app, run “debug”, launch Rhino… etc… and make changes via hot reload as need. I’m not 100% sure what “attach” means in this context; I use “attach” with VS Code, AutoLISP and AutoCAD (“Attach” in that context means it works with an active session of AutoCAD opposed to launching a brand new session). Anything I code is pretty simple and almost likely better suited for RhinoScript. I already has some C# skills and figured I could use C# for both AutoCAD and Rhino, so I doubled-down on C#. In spite of using C# and Visual Studio my code is relatively simple and therefore, actually going through the whole process is agonizing.

1 Like

I think you already understood what I meant by attach, but just in case → Attach to running processes with the debugger - Visual Studio (Windows) | Microsoft Learn

Let me know if that fixes it, and if not, we can try something else :+1:

1 Like

You’ve given me quite a bit of good info. I’ll be giving this a try.