Problem converting source code created in Rhinoscript compiler into C# project


I have a lot of my own python scripts compiled into rhp file and I want to migrate these scripts to C#

In Rhinoscript compiler I have created C# project but I can not make it to work. I fail to “connect” the resource file

In picture below see the error I get in VS 2015 community edition when I try to start any of my command from Rhino.

Plugin loads without problem but running any of the plugin commands produces this error

I am C# beginner…

Thanks in advance,

I have no idea what this means. Do you mean you’ve created a RhinoCommon plug-in project using Visual Studio?

– Dale

sorry for being not clear, this is step by step what I did:

  1. with RhinoScript Compiler I created c# source files from my collection of python scripts
  2. in Visual Studio, with the RhinoCommon wizard I created a c# project plugin
  3. in C# project from point 2 I imported all files from point 1
  4. after fixing some namespace issues I managed to build the VS plugin project created in point 3 and load it into Rhino

But when I try to run any of the plugin commands, I get error about resource file not found…( see my first post )

in the meanwhile I found the solution on this page:

following the instructions from this page, by using ILDasm.exe, I discovered the how to change the name of the resource in the following line in each of my command’s class files:

  System.Resources.ResourceManager rm = new System.Resources.ResourceManager("ScriptCode",

instead of the “ScriptCode” I had to put “MyPlugin.Resources.ScriptCode” in order to make it work

( ILDasm showed me that my resource name is MyPlugin.Resources.ScriptCode.resources)

I’m not expirienced in C# so I don’t really know why it has to be like that but it works! :slight_smile:

If there is an easier way to create VS C# project from source created by RhinoScript compiler I would be happy to learn it


Hi @AleksandarSM,

I’m really confused as to what you are trying to do. Are you trying to embed some RhinoScript code in a C# plug-in? Perhaps you can clarify what your goal is?

– Dale

Hello Dale,

My final goal is to migrate ( and translate ) my plugin from python to C# and to continue developing plugin in visual studio and C#

Besides obvious advantages that come from moving plugin from python to C#, I want to do it also to start learning C#…( at this point I am c# beginner )

First step was to “convert” plugin project built with script compiler in to plugin project on which I can continue to work in c# and Visual studio.

Next step would be to translate existing commands one by one from python into C# without losing functionality of the plugin

with “conversion” like this, I don’t need to wait to translate all commands to c# before my plugin becomes fully functional and entirely written in C#

For example, when I translate one command to c#, I can simply replace the existing (old) class file for that command with new one, written completely in c# ( like mentioned before, at the moment I’m not experienced in C# so translating takes time)

For this “conversion” I have used functionality of script compiler to create C# project from the existing plugin project

In created c# project, all my python scripts are inside one resource file and each plugin command has a class file that take the python code from the resource and run it

At this point I came to problem - this c# project had errors and I could not compile it in visual studio
The error was with the resource file ( that was my question in the first post )

At first I did not know how to solve it but then I came across the solution ( described in my last post )

On the end I was curious if there was some simple, more “elegant” solution to the problem than changing the code in all command class files

Hope it is more clear now…