picoe / Eto

Cross platform GUI framework for desktop and mobile applications in .NET
Other
3.52k stars 319 forks source link

[macOS] Error loading macOS .NET 6 workload project in Rider #2621

Open alastairlundy opened 4 months ago

alastairlundy commented 4 months ago

Hi, I just created an Eto app on macOS using the dotnet template for the first time (usually I do so on Windows or Linux). I figured since this is my first time creating an Eto Forms project on macOS that I'd try the .NET 6 workload project so I created the project with that as an option. I created a new solution in Rider and started adding the projects generated by the tempate and Rider says it's unable to load the macOS workload project.

Expected Behavior

The macOS .NET 6 workload project loads in Rider.

Actual Behavior

The macOS .NET6 workload project fails to load in Rider due to an error.

The error message is:

[NETSDK1135] SupportedOSPlatformVersion 10.14 cannot be higher than TargetPlatformVersion 0.0. at (215:5)

Target: _CheckForSupportedOSPlatformVersionHigherThanTargetPlatformVersion 
Task: NETSdkError

Specifying a TargetPlatformVersion doesn't help and causes it's own error. I supplied it with 13.0 which should be a valid version.

[NETSDK1140] 13.0 is not a valid TargetPlatformVersion for macos. Valid versions include: None at (243:5) 
Target: _CheckForInvalidTargetPlatformVersion
Task: NetSdkError

Steps to Reproduce the Problem

  1. Open a solution containing a macOS workload project in Rider on macOS
  2. Try to load the macOS workload project

Code that Demonstrates the Problem

Here's the contents of the CSPROJ file for the macOS .NET 6 workload.

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>net6.0-macos</TargetFramework>
    <OutputType>Exe</OutputType>
    <SupportedOSPlatformVersion>10.14</SupportedOSPlatformVersion>
    <RuntimeIdentifiers>osx-x64;osx-arm64</RuntimeIdentifiers>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Eto.Platform.macOS" Version="2.8.2" />
  </ItemGroup>

  <ItemGroup>
    <ProjectReference Include="..\Packaging\Packaging.csproj" />
  </ItemGroup>
</Project>

Specifications

Notes

As an aside, I'd recommend adding the references to the Eto Forms dotnet template via using statements so that the projects can be built out of the box (barring any other issue(s)) as the template's projects need tweaking to work. Thankfully Rider says what the problems are but it would be nice for these to also be fixed.

Thanks in advance.

cwensley commented 4 months ago

Do you by any chance have .NET 8 SDK installed? Apparently the net6.0-macos workload is not supported with that, and follows the MAUI support policy. Looks like the macos versions should be bumped to at least .NET 7.

alastairlundy commented 3 months ago

Do you by any chance have .NET 8 SDK installed? Apparently the net6.0-macos workload is not supported with that, and follows the MAUI support policy. Looks like the macos versions should be bumped to at least .NET 7.

Sorry for the late response.

Yes, I do have the .NET 8 SDK installed.

If I understand the .NET MAUI support policy correctly then the .NET 7 workload will soon have the same issue, so perhaps .NET 8 would be a safer choice.

Edit: This also works: explicitly stating that if you want to use .NET 6 MAUI for Mac that you need to only have the .NET 6 SDK installed and allow people who want to use .NET 8 MAUI to choose that if they have the .NET 8 SDK installed.