I saw elsewhere that McNeel is only making/supporting the Visual Studio Extensions. And the guides recommend using them: Installing Tools (Windows) with C#, VB
However on their github it looks like I can install a rhinocommon template just with dotnet: https://github.com/mcneel/RhinoVisualStudioExtensions
(The grasshopper specific extension looks like simple csproj files, although its pretty old:
So I was wondering if anybody has been using just the dotnet templates or Rider and if there are any challenges to watch out for with this method vs the recommended VS Extension.
Hi, if I remember correctly, you need to pay attention to 3 things:
Create a library project targeting the correct Framework. Basically all recent Rhino Versions are using .Net Framework 4.x.
Of course, the lower your standard is, the more legacy versions of Rhino you can truly support. Rhino 5 uses Framework 4.0. A .dll compiled with 4.0 will also run in a higher 4.x version! However, the lower the number, the lesser C# language features are supported. 4.0 will run for Rhino 5,6,7, (8?)
You have to override the AssemblyInfo just like the TemplatePackage shows. This way, Grasshopper can harvest all information required for your plugin. The same is true for components. However, make sure to create a new GUID anywhere you find one.
I think as a post-build process, the compiled .dll file-ending is renamed to ‘.gha’. The template does not differentiate between Release and Debug build. I have no clue why this is not the case. Since you can always attach a debugger on a running Rhino process. If no .pdb file is there, you obviously cannot step through. So in my oppinion it makes sense to differ.
Once you have the .gha compiled, you have to move it into the plugin folder of Grasshopper, or you modify Grasshopper to load from a different folder (it makes sense to select the bin folder, where the .pdb is located).
I work with Rider only, and I cannot remember any challanges because of that. Maybe for the first time it was the problem to find a way to work with Resources there (to add icons for components), but once you know how it works - it is doable. Unit testing with rhincommon also works well.
That’s great to hear! I’ve only been using Rider for a month and don’t want to switch back to VS unless I have to. Would you mind letting me know what you did to set up for grasshopper, besides fixing the Resources thing? If you had like a sample project, it would help me out tremendously.
I advice you to create a template using VS only for the very first time, save it somewhere as a template, and later work with it only using Rider. Later you could use this template for new plugins, without opening VS anymore.
I don’t have any sample like this, but all of these open-source plugins were made using Rider: https://github.com/paireks
@w.radaczynski Thank you, I needed help getting a leg up on this. Didn’t realize pterodactyl/etc were done this way.
Also your personal site looks good! I hope you’ve been getting good commissions.
So yeah, you download dozens of gb just to build a template? Wow, that’s a neat solution! If you are not able to set up a project, you really should start there first…
Hehe I know what you mean, and I agree that building it from scratch is a good idea, but believe me, that for someone who just starts his journey with Grasshopper plugin development and C#, and don’t want to do it in Visual Studio, but somewhere else: it is better to see how this original template works and looks like anyway, rather to figure it out all by himself.
It is not our fault that there is a template only for VS. I admit your answer @TomTom was really good, but for begginers it is probably overwhelming to set all things up properly from scratch without a template .
Yeah, kind of harsh formulated. But my point is really you have to understand what’s going on. At least at some point. Templates are great, but if you are a beginner, stick to Visual Studio Community and do what all the others do. I mean, what’s the point in buying a professional IDE, if you are missing basic knowledge?
There was a time before we had this template. The Grasshopper developer SDK explained how to configure Visual Studio and what to do (and also why!).
It’s migrate to the web here:
But except of what I mentioned, there is not much to explain. Maybe that you reference Rhinocommon.dll but not creating a local copy in the bin folder.
I remember this being Chinese for me at first. But understanding how a .net project is build is really helpful…