Hi,
I am trying to load a project in Visual Studio Mac, but I cannot reference RhinoCommon properly.
I tried to install Rhinocommon via package manager but the reference is till not recognised. How can I reference assemblies in Mac Visual Studio?
Hi,
I am trying to load a project in Visual Studio Mac, but I cannot reference RhinoCommon properly.
I tried to install Rhinocommon via package manager but the reference is till not recognised. How can I reference assemblies in Mac Visual Studio?
Hi @Petras1, it’s been a long time since I did it, but I believe everything is explained there : Installing Tools (Mac) with C#
Install the tools found there and load it then from visual studio>extensions
Thanks for the tutorial @flixchameroy . The tutotial is about creating a new project based on a template.
But how do you reference rhinocommon for an empty c# ? I am a newbie on mac and possibly missing smth simple.
On the menu bar, go to Project>Add Reference ?
And for mac I can reference the same rhinocommon.dll? Is this .dll typically found in application folder?
I’m really no specialist but I think yes.
RhinoCommon.dll is typically found at /Applications/Rhino 7.app/Contents/Frameworks/RhCore.framework/Versions/A/Resources/RhinoCommon.dll
, you can browse to there while adding a .Net Assembly
You might also need RhinoUi.dll which you can find in the same folder, and Grasshopper.dll or GH_IO.dll, which you’ll get at /Applications/Rhino 7.app/Contents/Frameworks/RhCore.framework/Versions/A/Resources/ManagedPlugIns/GrasshopperPlugin.rhp/Grasshopper.dll
Thank you it helps a lot.
I am trying to build OpenNest.gha but it gives me following error. Any ideas why building could fail?
Looks like renaming from .dll to .gha fails but no idea why.
It seems windows visual studio projects dont simply work on mac. It only works if I create new grasshopper visual studio project and copy paste the .cs files.
The .csproj format is cross-platform, but older projects may use platform-specific elements such as post-build steps that rely on commands that are only present on one operating system (i.e. Copy
).
Here’s an example of a cross-platform .csproj (using the modern sdk-style format) that’s generated by the current Rhino 7 C# project template…
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net48</TargetFramework>
<Version>1.0</Version>
<Title>rhino_test</Title>
<Description>Description of rhino_test</Description>
<TargetExt>.gha</TargetExt>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Grasshopper" Version="7.4.21078.1001" 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>
It uses TargetExt
to set the extension instead of a post-build step.
Thank you @will
It seems that my project is 2-3 years old, meaning this post-build was causing troubles. I am glad the newer template is more cross-platform friendly.