Problem targeting Linux and MacOS with .NET 6 and Visual Studio 2022

Richard Rosenheim 86 Reputation points
2022-09-03T14:51:54.063+00:00

I wrote a basic .NET 6 console app. It works fine under Windows. But, when I specify MacOS as the target OS in Visual Studio 2022 under Properties, I get these error messages when I attempt to build/publish:

Error NU1012 Platform version is not present for one or more target frameworks, even though they have specified a platform: net6.0-macos Text2Folders D:\Projects\myTestApp\myTestApp.csproj 1
Error NETSDK1147 To build this project, the following workloads must be installed: macos
To install these workloads, run the following command: dotnet workload restore Text2Folders C:\Program Files\dotnet\sdk\6.0.400\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.ImportWorkloads.targets 38

I attempted to run the "dotnet workload restore" command, but that only gave me these error messages:

Installing workloads: macos

Advertising manifest not updated. Manifest package for microsoft.net.sdk.android doesn't exist.
Advertising manifest not updated. Manifest package for microsoft.net.sdk.ios doesn't exist.
Advertising manifest not updated. Manifest package for microsoft.net.sdk.maccatalyst doesn't exist.
Advertising manifest not updated. Manifest package for microsoft.net.sdk.macos doesn't exist.
Advertising manifest not updated. Manifest package for microsoft.net.sdk.maui doesn't exist.
Advertising manifest not updated. Manifest package for microsoft.net.sdk.tvos doesn't exist.
Advertising manifest not updated. Manifest package for microsoft.net.workload.mono.toolchain doesn't exist.
Advertising manifest not updated. Manifest package for microsoft.net.workload.emscripten doesn't exist.
Downloading Microsoft.macOS.Sdk.Msi.x64 (12.3.446-ci.-release-6-0-4xx.446)
Workload installation failed. Rolling back installed packs...
Workload installation failed: One or more errors occurred. (microsoft.macos.sdk.msi.x64::12.3.446-ci.-release-6-0-4xx.446 is not found in NuGet feeds C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\".)

I also get the same error messages when I attempt to specify Linux as well.

Anyone have any suggestions on how I can resolve these issues?

Thanks in advance.

Developer technologies Visual Studio Other
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.