Debugging using Rhino 7 for Mac

I want to debug a Grasshopper plugin using Visual Studio for Mac (2022, 17.4.4 build 12), but can’t get Visual Studio to start debugging using Rhino.

I have installed the Visual Studio extension:

I have configured the Visual Studio project to start the app like this:

However, Visual Studio shows the option to start debugging as disabled:
image

The plugin project has been created on Windows, and works perfectly fine there. Are there some Mac-specific settings that should be changed in the csproj file?

@dan would you have a hint for me?

Hi Alexander-

Hmmmmm, I’d only be speculating without being able to see the .csproj file. Have you tried creating a boiler-plate “test” project from the RhinoCommon Visual Studio extension templates to see if you can debug that way? (When I do that here, I’m able to debug and hit breakpoints.) If you are able to, we’d need to figure out what is different between the contents of the .csproj (looking at the xml source) files themselves.

@curtisw may also have other insight here.

Good point, I will create a new project using the extension and compare the csproj files. Will let you know what I find out.

I created a project from scratch using the extension, and debugging works. The csproj file is quite minimalistic:

<Project Sdk="Microsoft.NET.Sdk">
	
  <PropertyGroup>
    <TargetFramework>net48</TargetFramework>
    <Version>1.0</Version>
    <Title>TestMacGhPlugin</Title>
    <Description>Description of TestMacGhPlugin</Description>
    <TargetExt>.gha</TargetExt>
  </PropertyGroup>
  
  <ItemGroup>
    <PackageReference Include="Grasshopper" Version="7.13.21348.13001" IncludeAssets="compile;build" />
  </ItemGroup>
  
  <PropertyGroup Condition="$(Configuration) == 'Debug' AND $([MSBuild]::IsOSPlatform(Windows))">
    <StartProgram>C:\Program Files\Rhino 7\System\Rhino.exe</StartProgram>
    <StartArguments></StartArguments>
    <StartAction>Program</StartAction>
  </PropertyGroup>

</Project>

I wonder what it is that tells Visual Studio where to find Rhino, to start debugging?

Can you check and confirm if the line
<PropertyGroup Condition="$(Configuration) == 'Debug'
is present when you do not use the boiler plate?

~ ~ ~ ~ ~ ~ ~ ~
Kaushik LS
Kleve, DE

I ended up digging into Rhino’s Visual Studio for Mac extension. Its code for detecting the McNeelProjectType doesn’t work in our case, due to the nesting level of .csproj files. I solved the problem by adding a RhinoPluginType property to my .csproj files.

<Project Sdk="Microsoft.NET.Sdk">
  …
  <PropertyGroup>
    …
    <RhinoPluginType>grasshopper</RhinoPluginType>
  </PropertyGroup>
  …
</Project>

Would be great to document this possibility somewhere, I found it here.

1 Like