Launch.json vs .csproj

Hello,

I’m quite new to component development with visual studio 2022 and have following problem:

I can’t get Rhino 8 to start with grasshopper and a specific file via the .csproj settings like this:

<PropertyGroup Condition="$(Configuration) == 'Debug' AND $([MSBuild]::IsOSPlatform(Windows))">
 <StartProgram>C:\Program Files\Rhino 8\System\Rhino.exe</StartProgram>
 <StartArguments>
  /netfx /runscript="_-RunScript (
  Set GH = Rhino.GetPlugInObject(""Grasshopper"")
  Call GH.OpenDocument(""C:\Users\MoeldersLeo\Desktop\testing.gh"")
  )"
 </StartArguments>
 <StartAction>Program</StartAction>
</PropertyGroup>

My launch.json looks like this:

{
  "profiles": {
    "Win Rhino 8 net48": {
      "commandName": "Executable",
      "executablePath": "C:\\Program Files\\Rhino 8\\System\\Rhino.exe",
      "commandLineArgs": "/netfx"
    }
  }
}

Without this commandLineArgs “/netfx” I get the NetCore error. How can I get this to run and respect the settings from csproj?

Thanks in advance for your help :slight_smile:

Hi @Lennard92

I beleive the Launch.json replaces or overrides that part of the .csproj file in the newer C# project templates so you need to move the StartArguments into commandLineArgs

The trick becomes that you will need to escape all of the characters.
I think this tool may help Free Online JSON Escape / Unescape Tool - FreeFormatter.com

Maybe this is close? It is not quite right but i do not have enough knowledge of Rhino Script to fix but hopefully it helps you along the path - good luck!

  "profiles": {
    "Rhino 8 - .net 7": {
      "commandName": "Executable",
      "executablePath": "C:\\Program Files\\Rhino 8\\System\\Rhino.exe",
"commandLineArgs": "/netcore /nosplash  /runscript=\"_-RunScript (\r\n  Set GH = Rhino.GetPlugInObject(\"\"Grasshopper\"\")\r\n  Call GH.OpenDocument(\"\"C:\\Users\\MoeldersLeo\\Desktop\\testing.gh\"\")\r\n  )\""
    }
  }
}
1 Like

Hi @david.birch.uk,

I already have it running from there like this:

I’m just curious why the other solution does not work for me, as I have seen it working here:

1 Like

I have a follow up question:

When I run Rhino via cmd from its directory with “/nosplash” it opens without splash screen as expected, but when I add “/nosplash” to the command above from Visual Studio it returns a plugin error before starting:

grafik

and another error when it finished loading:

grafik

Furthermore it does not open the grasshopper file.

Anybody an idea?