I like to share my approach in executing C# scripts with Rhino using VS Code.
1.) Download VS Code , open VS Code, open a new Folder
2.) Search & Load the Microsoft C# Extention
3.) Go in the terminal and write: dotnet new console
-> This opens a new console application. We don’t compile from vscode, so we only need to get a basic project setup having a .csproject file.
4.) open the cs.project file and under
<ItemGroup> <Reference Include="RhinoCommon"> <HintPath>C:\Program Files\Rhino 6\System\RhinoCommon.dll</HintPath> <Private>False</Private> </Reference> </ItemGroup>
This allows us to work with Intellisense/autocompletion
You may need to change the Absolute Path pointing to the RhinoCommon.dll
5.) write in the vscode terminal : dotnet restore
we now have intellisense for Rhinocommon
6.) Remove the Program.cs file
we write our own cs files. Do not use this one, since this file is encoded with the bom header and loading
this file will return an compilation error.
8.) Now check the compileCSharp python file if the location of the Rhinocommon lib fits, and execute this within the Rhino Python editor to execute the test.cs file. You can also use the _RunPythonScript command
9.) Start writing your cs code