How to fix restore issue of a .net 7 Mac native app project with VS Code for Mac IDE on my Mac PC?

Sun, Tracy (LNG-SHA) 40 Reputation points
2024-03-13T08:46:50.44+00:00

Hi all,

I have a project, it's a net7.0-macos app published on Mac AppStore. the following is a part of the file of *.csproj.

<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>

<TargetFramework>net7.0-macos</TargetFramework>

As knows, net7.0 will expire on May, 2024 and the same time Visual Studio for Mac will expire, so I have a try to update net7.0 to net8.0, Can you give me some solution how to upgrade my project to net8.0? Currently I use Visual Studio for Mac to develop.

User's image

If I load my project with Visio Studio Code, The output log says:

Determining projects to restore...

/usr/local/share/dotnet/sdk/8.0.201/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.ImportWorkloads.targets(38,5): error NETSDK1147: To build this project, the following workloads must be installed: macos [/Users/sunxx/LexisRed/LexisNexis.Red.Mac.Dotnet7/LexisNexis.Red.Mac.Dotnet7.csproj]

/usr/local/share/dotnet/sdk/8.0.201/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.ImportWorkloads.targets(38,5): error NETSDK1147: To install these workloads, run the following command: dotnet workload restore [/Users/sunxx/LexisRed/LexisNexis.Red.Mac.Dotnet7/LexisNexis.Red.Mac.Dotnet7.csproj]

User's image

Could you tell me how can I to fix the issue.

Thanks a lot!

.NET
.NET
Microsoft Technologies based on the .NET software framework.
3,323 questions
.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
2,813 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Bruce (SqlWork.com) 54,621 Reputation points
    2024-03-13T20:58:46.8466667+00:00

    the issue is Xamarin (macOS app) is retired and not supported by .net 8. So you need to pick a migration path.

    While you could upgrade to Maui, it only supports Mac Catalyst apps. Also with Maui there is no built in support for using storyboard, but it can be done. If you used Xamarin forms, and not storyboard, and can live with the Mac Catalyst limitations, this might a good path. You will need to pick a new development tool, Visual Studio Code, JetBrains Rider or Parallels hosting Windows and Visual Studio.

    https://learn.microsoft.com/en-us/dotnet/maui/get-started/installation?view=net-maui-8.0&tabs=vsmac

    If you used storyboard, you might just want to migrate to Swift.