on Rhino8 for the MAC how do we access winforms? Meaning that all the UI extension for grasshopper are tided to winform and in .net 7 winforms are not available on the mac. Is there something I am missing? E.g. the following code will not build on the mac (C#)
public override bool AppendMenuItems(ToolStripDropDown menu)
{
var output = base.AppendMenuItems(menu);
Menu_AppendSeparator(menu);
Menu_AppendItem(menu, textItem, (s, e) => { RhinoApp.WriteLine("Does not build"); });
}
is there a package on nuget that we can reference or any suggestion you have?
@Alberto The ToolStripDropDown is a System.Windows.Forms type. On macOS try adding System.Windows.Forms in the Rhino 8 folder to your project. Do not include that with your plugin distribution as it is already shipped with Rhino
@curtisw Is there a NuGet package to use for macOS Grasshopper plugin builds that need access to ToolStripDropDown and other similar types?
@curtisw would it be possible to include the mac-specific versions of System.Windows.Forms.dll and System.Drawing.Common.dll in the RhinoCommon nuget package (for the macos platform) ?
Yes we can add that, currently the only way to get access to System.Windows.Forms is to target net48. As for System.Drawing.Common it’s already a nuget package which you can reference (but don’t include the .dll as part of your plugin). I’ve created RH-80655 to get that included.
Not a C# expert so maybe I am missing something obvious, but I’m converting a C# script to a plugin. It uses Rhino.UI.SaveFileDialog which requires some types from System.Windows.Forms. I’ve read through this post, but it isn’t entirely clear to me what the solution is. Here is my .csproj unmodified from the template I just used:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<!-- Select the framework(s) you wish to target.
Rhino 6: net45
Rhino 7: net48
Rhino 8 Windows: net48, net7.0, net7.0-windows, net7.0-windows10.0.22000.0, etc
Rhino 8 Mac: net7.0, net7.0-macos, net7.0-macos12.0, etc
-->
<TargetFrameworks>net7.0;net48</TargetFrameworks>
<EnableDynamicLoading>true</EnableDynamicLoading>
<TargetExt>.rhp</TargetExt>
<NoWarn>NU1701</NoWarn>
</PropertyGroup>
<PropertyGroup>
<!-- Specifies information for Assembly and Yak -->
<Version>1.0</Version>
<Title>rhino-cube-plugin</Title>
<Company>rhino-cube-plugin Authors</Company>
<Description>Description of rhino-cube-plugin</Description>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Grasshopper" Version="8.0.23304.9001" ExcludeAssets="runtime" />
</ItemGroup>
</Project>
I don’t plan to distribute this (at least anytime soon), and will just be using it on OS X/Rhino 8. If I add the ItemGroup snippet from Curtis’ last post, but change the TargetFramework to net7.0, and remove net48 from the TargetFrameworks at the top I get a successful build (with a warning SaveFileDialog.ShowDialog()' is obsolete: 'Use ShowSaveDialog). Is that the correct solution? Are there some docs I should read that I haven’t spotted yet?
I know this is an old thread, but it seems to be exactly what I’m seeing so seems better to reply than start a new one.