Up-To-Date Cross-Platform Development Best Practices

Hey developers,

how do you set up your projects to have the least painful experience for cross-platform plugin development? The official guide is fairly dated now:

I’ve switched to a multi-target setup as described here by @curtisw and @stevebaer:

Most of the UI is based on custom Eto.Forms:

But for some functionality (WebView2 for Rhino 7, docking UI elements to viewports, etc.) I need platform-specific code. How do you deal with these cases? Do you sprinkle your code with conditional build statements, or have parallel versions of selected classes? What about nuget packages and other references?

I’d be eager to learn what the recommended best-practices are.

2 Likes

Following this! I’ve struggled with GH-components.
The guides and templates use dual target frameworks and I get warnings that the Grasshopper package was restored using several frameworks. Also some methods take Windows forms as arguments which cause more challenges. Especially for a n00b like me…

My current approach (inspired by @menno) is to selectively include references based on the target Rhino version.

  1. Switch between R7 or R8
  2. Choose the corresponding runtime environment
  3. Select a launch profile

This is already quite involved despite targeting only Windows so far. Adding MacOS will double the complexity and I’d like to find a more robust approach. It happens way too often that I forget to change RhinoVersion to the desired value before hitting debug…

I’ve been wondering this exact thing as well. Eager to hear what can be done.

1 Like