Installing visual studio for Mac extension

@curtisw i downloaded and installed successfully the visual studio for Mac 2019 community edition as well as the 8.x mpack
The extension shows up green if I go to the extensions manager. But the Rhino namespace isn’t recognized. What am I missing?

I’m sure it has something to do with the dependencies. RhinoCommon is referenced (7.18) but still it doesn’t work.

@Gijs What target framework is your project? it must be .NET 4.8. Did you create the project using the Rhinoceros project wizard? Are you using a SDK-style csproj or a legacy csproj?

The mpack isn’t what provides the Rhino namespace, it comes from the nuget reference and works even without the extension installed. The extension provides the project templates and helps launch Rhino when debugging.

If none of the above helps, zipping up your project and attaching here so we can take a look would help greatly.

Cheers,
Curtis.

Thanks I’ll look later. Where can I see what .net version it is targeted at?

With VS for Mac, double click on the project and look at what is set for Build > General > Target Framework, or right click the project and select Edit Project File then look at the <TargetFramework> property shown here:

that was it, thanks!

Maybe I can add my question right away. I am still unable to get on Mac into Debugging mode as I can’t set the Application (everything is grayed out).

Now I see I have to set the <RhinoMacLauncher> in the *.csproj file. Where should I include this?

Attached the AntFarm.csproj file we are using since a long time. Might be not the latest and cleanest possible.

AntFarm.zip (5.4 KB)

I would need this file to work on Windows and Mac - might be nessesary to set a platform dependency?

Kindest
Christian

I can’t figure out how to get started debugging on Mac. I added the

<RhinoMacLauncher>/Applications/Rhino 7.app</RhinoMacLauncher>

in the project file, but no change. Here a screenshot from the file.

What am I doing wrong? I also tried to start the Rhino - Your First Plugin (Mac) (rhino3d.com) and I can’t even get the extension to install (Rhino Extension in VS 2022 pre-release MAC disabled - Rhino Developer - McNeel Forum).

Any help would be much appreciated.

Kindest
Christian

Is there anyone that could help with this topic? @curtisw or @dan maybe. I would really like to get started on Mac.

Much appreciated.

Kindest
Christian

Hey @Christian_Hartz,

The VS for Mac extension only works for VS for Mac 2019 currently. I’ve added RH-68876 to get that updated now that VS 2022 is finally released. Thanks for the poke!

First thing you might want to do is to modernize your projects to use sdk-style. This so you can compile using the dotnet command line on Mac (or Windows). The Upgrade Assistant on Windows might be helpful to migrate existing projects, though I haven’t used it myself. All of the current Rhino project templates use this format for better cross platform portability. Note that you can still compile for .NET 4.8 using the new csproj format.

Alternatively, you can use VS Code and Rhino’s VS Code Debug Extension to debug 7.x, or just the C# extension’s built-in coreclr debugger for 8.x. We use this internally for Mac .NET development, which has worked fairly well for us.

Hope this helps!

1 Like

Hi @curtisw,

I need to get to Vancouver one day and invite you for a beer or something. Amazing support. Thanks so much. Cant wait to get the 2022 Mac template. Just transfered the project to sdk-style (we’ve been developing this plugin for years and on windows, well no problem).

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>net48</TargetFramework>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug64</Configuration>
    <OutputType>Library</OutputType>
    <IsWebBootstrapper>false</IsWebBootstrapper>
    <GenerateResourceUsePreserializedResources>true</GenerateResourceUsePreserializedResources>
    <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
    <UseWPF>true</UseWPF>
    <ImportWindowsDesktopTargets>true</ImportWindowsDesktopTargets>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <OutDir>bin\</OutDir>
    <DefineConstants>ISWIN;ON_RUNTIME_APPLE</DefineConstants>
    <LangVersion>8.0</LangVersion>
  </PropertyGroup>
  <PropertyGroup>
    <StartupObject />
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <OutDir>bin\</OutDir>
    <RunCodeAnalysis>false</RunCodeAnalysis>
    <DefineConstants>DEBUG;ISWIN;ON_RUNTIME_APPLE;CODE_ANALYSIS;</DefineConstants>
    <LangVersion>8.0</LangVersion>
  </PropertyGroup>
  <PropertyGroup>
    <ApplicationIcon>Resources\ant_2048.ico</ApplicationIcon>
  </PropertyGroup>
  <PropertyGroup>
    <RunPostBuildEvent>Always</RunPostBuildEvent>
  </PropertyGroup>
  <ItemGroup>
    <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
  </ItemGroup>
  <ItemGroup>
    <None Include="..\.editorconfig">
      <Link>.editorconfig</Link>
    </None>
  </ItemGroup>
  <ItemGroup>
    <EmbeddedResource Include="Resources\category_delete.ico" />
    <EmbeddedResource Include="Resources\element_add.ico" />
    <EmbeddedResource Include="Resources\element_remove.ico" />
    <EmbeddedResource Include="Resources\rename.ico" />
    <EmbeddedResource Include="Resources\change_colour.ico" />
    <EmbeddedResource Include="Resources\element_copy.ico" />
    <EmbeddedResource Include="Resources\locked.ico" />
    <EmbeddedResource Include="Resources\unlocked.ico" />
    <EmbeddedResource Include="Resources\propertytype_new.ico" />
    <EmbeddedResource Include="Resources\propertytype_delete.ico" />
    <EmbeddedResource Include="Resources\propertytype_changetype.ico" />
    <EmbeddedResource Include="Resources\property_add.ico" />
    <EmbeddedResource Include="Resources\property_remove.ico" />
    <EmbeddedResource Include="Resources\category_new.ico" />
    <EmbeddedResource Include="Resources\Database.png" />
    <EmbeddedResource Include="Resources\element.ico" />
    <EmbeddedResource Include="Resources\RhinoLogoBlock.png" />
    <Content Include="_site\api\AntFarm.API.APIPropertyBaseType.html" />
    <Content Include="_site\api\AntFarm.API.Events.APIInternalEventArgs.html" />
    <Content Include="_site\api\AntFarm.Kernel.Types.Attributes.AFAttributeType.html" />
    <Content Include="_site\api\AntFarm.Kernel.Types.Attributes.AFGeometric.html" />
    <Content Include="_site\api\AntFarm.Kernel.Types.Attributes.AFGeometricAttributeType.html" />
    <Content Include="_site\api\AntFarm.Kernel.Types.Attributes.html" />
    <Content Include="_site\api\AntFarm.Kernel.Types.Attributes.SQLiteType.html" />
    <EmbeddedResource Include="Resources\ant_2048.ico" />
  </ItemGroup>
  <ItemGroup>
    <WCFMetadata Include="Connected Services\" />
  </ItemGroup>
  <ItemGroup>
    <PackageReference Include="docfx.console" Version="2.59.2" />
    <PackageReference Include="Grasshopper" Version="7.18.22124.3001">
      <ExcludeAssets>runtime</ExcludeAssets>
      <PrivateAssets>false</PrivateAssets>
    </PackageReference>
    <PackageReference Include="LumenWorksX.Framework.IO" Version="1.0.1" />
    <PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
    <PackageReference Include="RhinoWindows" Version="7.18.22124.3001">
      <ExcludeAssets>runtime</ExcludeAssets>
      <PrivateAssets>false</PrivateAssets>
    </PackageReference>
    <PackageReference Include="System.Collections" Version="4.3.0" />
    <PackageReference Include="System.Collections.Specialized" Version="4.3.0" />
    <PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" />
    <PackageReference Include="System.Data.DataSetExtensions" Version="4.5.0" />
    <PackageReference Include="System.Data.SQLite" Version="1.0.115.5" />
    <PackageReference Include="System.Resources.Extensions" Version="6.0.0" />
    <PackageReference Include="System.Runtime" Version="4.3.1" />
    <PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="6.0.0" />
    <PackageReference Include="System.Threading.Tasks.Extensions" Version="4.5.4" />
  </ItemGroup>
  <ItemGroup>
    <Compile Remove="Kernel\AntFarmDocument.cs" />
    <Compile Remove="Kernel\Commands\AFCmdBuilder.cs" />
    <Compile Remove="Kernel\Commands\AFcmdTypes.cs" />
    <Compile Remove="Kernel\Events\AntFarmCopyPaste.cs" />
    <Compile Remove="UI\Controls\AFColourCell.cs" />
    <EmbeddedResource Remove="Lang\lang_de.resx" />
  </ItemGroup>
  <ItemGroup>
    <None Remove="AntFarm.csproj.bak" />
    <None Remove="log.txt" />
  </ItemGroup>
  <Target Name="CopyRHPFile" AfterTargets="AfterBuild">
    <Copy SourceFiles="$(OutDir)\$(ProjectName).dll" DestinationFiles="$(OutDir)\$(ProjectName).rhp" OverwriteReadOnlyFiles="True" />
  </Target>
  <PropertyGroup>
    <FallbackCulture>en-US</FallbackCulture>
    <BaseOutputPath>bin\</BaseOutputPath>
  </PropertyGroup>
</Project>

Where would I add?

<RhinoMacLauncher>/Applications/Rhino 7.app</RhinoMacLauncher>

Kindest
Christian

@curtisw,

I edit the .csproj file once again and its much nicer than before, I guess.

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>net48</TargetFramework>
    <OutputType>Library</OutputType>
	<IsWindows Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Windows)))' == 'true'">true</IsWindows>
    <IsOSX Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::OSX)))' == 'true'">true</IsOSX>
    <IsWebBootstrapper>false</IsWebBootstrapper>
    <GenerateResourceUsePreserializedResources>true</GenerateResourceUsePreserializedResources>
    <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
    <UseWPF>true</UseWPF>
    <ImportWindowsDesktopTargets>true</ImportWindowsDesktopTargets>
	<StartAction>Program</StartAction>
    <StartProgram>C:\Program Files\Rhino 7\System\Rhino.exe</StartProgram>
    <LangVersion>8.0</LangVersion>
	<RhinoMacLauncher>/Applications/Rhino 7.app</RhinoMacLauncher>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' And '$(IsWindows)'=='true'">
    <OutDir>bin\</OutDir>
    <DefineConstants>ISWIN;ON_RUNTIME_APPLE</DefineConstants>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' And '$(IsWindows)'=='true'">
    <OutDir>bin\</OutDir>
    <DefineConstants>ISWIN;ON_RUNTIME_APPLE;DEBUG;CODE_ANALYSIS</DefineConstants>
    <RunCodeAnalysis>false</RunCodeAnalysis>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' And '$(IsOSX)'=='true'">
    <OutDir>bin\</OutDir>
    <DefineConstants>ISMAC;ON_RUNTIME_APPLE</DefineConstants>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' And '$(IsOSX)'=='true'">
    <OutDir>bin\</OutDir>
    <DefineConstants>ISMAC;ON_RUNTIME_APPLE;DEBUG;CODE_ANALYSIS</DefineConstants>
    <RunCodeAnalysis>false</RunCodeAnalysis>
  </PropertyGroup>
  <PropertyGroup>
    <ApplicationIcon>Resources\ant_2048.ico</ApplicationIcon>
  </PropertyGroup>
  <PropertyGroup>
    <RunPostBuildEvent>Always</RunPostBuildEvent>
  </PropertyGroup>
  <ItemGroup>
    <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
  </ItemGroup>
  <ItemGroup>
    <None Include="..\.editorconfig">
      <Link>.editorconfig</Link>
    </None>
  </ItemGroup>
  <ItemGroup>
    <EmbeddedResource Include="Resources\category_delete.ico" />
    <EmbeddedResource Include="Resources\element_add.ico" />
    <EmbeddedResource Include="Resources\element_remove.ico" />
    <EmbeddedResource Include="Resources\rename.ico" />
    <EmbeddedResource Include="Resources\change_colour.ico" />
    <EmbeddedResource Include="Resources\element_copy.ico" />
    <EmbeddedResource Include="Resources\locked.ico" />
    <EmbeddedResource Include="Resources\unlocked.ico" />
    <EmbeddedResource Include="Resources\propertytype_new.ico" />
    <EmbeddedResource Include="Resources\propertytype_delete.ico" />
    <EmbeddedResource Include="Resources\propertytype_changetype.ico" />
    <EmbeddedResource Include="Resources\property_add.ico" />
    <EmbeddedResource Include="Resources\property_remove.ico" />
    <EmbeddedResource Include="Resources\category_new.ico" />
    <EmbeddedResource Include="Resources\Database.png" />
    <EmbeddedResource Include="Resources\element.ico" />
    <EmbeddedResource Include="Resources\RhinoLogoBlock.png" />
    <Content Include="_site\api\AntFarm.API.APIPropertyBaseType.html" />
    <Content Include="_site\api\AntFarm.API.Events.APIInternalEventArgs.html" />
    <Content Include="_site\api\AntFarm.Kernel.Types.Attributes.AFAttributeType.html" />
    <Content Include="_site\api\AntFarm.Kernel.Types.Attributes.AFGeometric.html" />
    <Content Include="_site\api\AntFarm.Kernel.Types.Attributes.AFGeometricAttributeType.html" />
    <Content Include="_site\api\AntFarm.Kernel.Types.Attributes.html" />
    <Content Include="_site\api\AntFarm.Kernel.Types.Attributes.SQLiteType.html" />
    <EmbeddedResource Include="Resources\ant_2048.ico" />
  </ItemGroup>
  <ItemGroup Condition=" '$(IsWindows)'=='true' ">
    <PackageReference Include="docfx.console" Version="2.59.2" />
  </ItemGroup>
  <ItemGroup>
    <PackageReference Include="Grasshopper" Version="7.18.22124.3001">
      <ExcludeAssets>runtime</ExcludeAssets>
      <PrivateAssets>false</PrivateAssets>
    </PackageReference>
    <PackageReference Include="LumenWorksX.Framework.IO" Version="1.0.1" />
    <PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
    <PackageReference Include="RhinoWindows" Version="7.18.22124.3001">
      <ExcludeAssets>runtime</ExcludeAssets>
      <PrivateAssets>false</PrivateAssets>
    </PackageReference>
    <PackageReference Include="System.Collections" Version="4.3.0" />
    <PackageReference Include="System.Collections.Specialized" Version="4.3.0" />
    <PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" />
    <PackageReference Include="System.Data.DataSetExtensions" Version="4.5.0" />
    <PackageReference Include="System.Data.SQLite" Version="1.0.115.5" />
    <PackageReference Include="System.Resources.Extensions" Version="6.0.0" />
    <PackageReference Include="System.Runtime" Version="4.3.1" />
    <PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="6.0.0" />
    <PackageReference Include="System.Threading.Tasks.Extensions" Version="4.5.4" />
  </ItemGroup>
  <ItemGroup>
    <Compile Remove="Kernel\AntFarmDocument.cs" />
    <Compile Remove="Kernel\Commands\AFCmdBuilder.cs" />
    <Compile Remove="Kernel\Commands\AFcmdTypes.cs" />
    <Compile Remove="Kernel\Events\AntFarmCopyPaste.cs" />
    <Compile Remove="UI\Controls\AFColourCell.cs" />
    <EmbeddedResource Remove="Lang\lang_de.resx" />
  </ItemGroup>
  <ItemGroup>
    <None Remove="log.txt" />
  </ItemGroup>
  <ItemGroup>
    <Compile Update="Properties\Settings.Designer.cs">
      <DesignTimeSharedInput>True</DesignTimeSharedInput>
      <AutoGen>True</AutoGen>
      <DependentUpon>Settings.settings</DependentUpon>
    </Compile>
  </ItemGroup>
  <ItemGroup>
    <None Update="Properties\Settings.settings">
      <Generator>SettingsSingleFileGenerator</Generator>
      <LastGenOutput>Settings.Designer.cs</LastGenOutput>
    </None>
  </ItemGroup>
  <Target Name="CopyRHPFile" AfterTargets="AfterBuild">
    <Copy SourceFiles="$(OutDir)\$(ProjectName).dll" DestinationFiles="$(OutDir)\$(ProjectName).rhp" OverwriteReadOnlyFiles="True" />
  </Target>
  <PropertyGroup>
    <FallbackCulture>en-US</FallbackCulture>
    <BaseOutputPath>bin\</BaseOutputPath>
  </PropertyGroup>
</Project>

If you have any time and there might be some improvements you see, I wouldn’t mind your feedback.

Kindest
Christian

1 Like

Hello @Christian_Hartz !

I’m also having trouble with the Mac version of our plugin. I tried modifying the .Mac.csproj file like you did but while building, it still would not appear in PluginManager when debugging. It also doesn’t appear when installing via a .macrhi package, even though the popup says it installs successfully.

I’m not sure if the issue is the .Mac.csproj file itself or the whole setup I made up untill then. I did the following with our windows plugin file:

  1. Unloaded project

  2. Copied it and renamed it to .Mac version

  3. Set up the compile conditional in the plugin.cs as follows:

#if ON_RUNTIME_MAC
            {
                var pluginPath = System.IO.Path.GetDirectoryName(Assembly.Location);
                var resourcesPath = System.IO.Path.Combine(pluginPath, "Resources");
                var plistPath = System.IO.Path.Combine(resourcesPath, "ToolPalette.plist");
                return base.OnLoad(ref errorMessage);
            }
#endif
  1. Removed the post-build event for the Mac version.

Am I missing something in this process? Any suggestion would be of great help.

Cheers,
Radu