Site Tools

Using Express Editions of VB.NET and C#

Summary: How to build and debug Rhino.NET plug-ins for Rhino 4 with the free express editions of Microsoft VB.NET 2008 and C# 2008.
Notice: The Rhino.NET SDK is deprecated in Rhino 5. This article adapted for the new RhinoCommon SDK and latest version of Visual Studio is here.

Microsoft now provides free trimmed down versions of their developer products called Express Editions. The two products in particular that I discuss here are the express editions of:

Use these products to develop .NET plug-ins for Rhino 4. Here are some helpful steps to get you started:

Download and install VB.NET or C#

Choosing between VB.NET and C# is a matter of syntax preference. Both programming languages should be able to build to the same quality plug-in. It just depends on the language that you feel more comfortable with. If you are not sure, download both.

The installer lets you choose which components to download and install. The default settings work fine for developing Rhino plug-ins. The extra unchecked items that you may be unsure about are:

  • Microsoft MSDN 2008 Express Edition - This is documention for the product and the .NET class libraries. You can find all this information online at I leave this option unchecked.
  • Microsoft SQL Server 2008 Express Edition - You may want this if you are interested in developing applications that work with SQL databases. This can also be downloaded and installed at a later date from the Microsoft website. I leave this option unchecked.

Install the Rhino.NET plug-in project and command wizards

Create a Rhino plug-in project

  1. Start either VB.NET or C# and go to File…New Project. You should see an option for Rhino Plug-In. Select this, provide a name for your project, and click OK. I choose the default project name of MyPlugIn1.
  2. A dialog should appear with options that the wizard uses when creating your plug-in project. Please note that you can always change these options at a later time in the code; these options just allow the wizard to fill out typical plug-in information. I choose to not change any of the default values and click the Finish button.
  3. Once your project is created, save it. I click on File…Save All to save the project to the location of my choice.

Compile the plug-in

I like to have the output window show when compiling my projects. This way I can see what is going on. To show this window, click Debug… Windows … Output.

You have to compile your project into a DLL (assembly) before you can try it in Rhino. Do this by clicking Build… Build my project name. The output window will tell you if everything went ok.

Debugging the plug-in

Here's the tricky part (and it's not really that tricky.) The express editions don't expose controls to set up your plug-in project for debugging. To debug your plug-in, tell the compiler that you want rhino4.exe to start and then have the debugger latch on to that process.

To set up the debugger for your project, perform the following steps:

  • Shut down VB.NET or C#.
  • Open file explorer and go to your project location. This is where the file with the extension .vbproj or .csproj is located.
  • Unzip and copy this file to the directory of your project.
  • Rename this file to the same name as your .vbproj file or .csproj file with .user appended to the end. For example:
    • If your .vbproj file is called MyFirstRhinoPlugIn.vbproj, then rename the downloaded file to MyFirstRhinoPlugIn.vbproj.user.
    • If your .csproj file is called MyCSharpRhinoPlugIn.csproj, then rename the downloaded file to MyCSharpRhinoPlugIn.csproj.user.
  • Open the downloaded file with Notepad. You will notice that it is a short XML file with a path to Rhino4.exe in it. Make sure that the path to Rhino4.exe is the same as where Rhino4.exe is located on your computer.

Run your plug-in

Once you've done the above, reopen your project in VB.NET or C# and click Debug… Start Debugging. If you were successful, Rhino will start.

Load your plug-in with the PlugInManager. Once your plug-in loads, try running the custom command that the wizard defined in your plug-in. If you click on the properties button in the plug-in manager you will see that your plug-in has a command named something like MyPlugIn1Command.

developer/dotnetexpresseditions.txt · Last modified: 2020/08/14 (external edit)