Ben Price
Ben Price

Reputation: 163

[VS MAC]Updating to .NET 8 all of my Maui projects display Error NETSDK1139: The target platform identifier ios was not recognized

Yesterday I updated from .NET 7.0 to .NET 8.0 following my colleague doing so and having it work immediately. For myself however, on both my VS Mac and my VS Windows I get the error

Error NETSDK1139: The target platform identifier ios was not recognized.

enter image description here

(This error also appears in the android variant if set to ios as the deploy target)

The target frameworks are listed as net8.0-android;net8.0-ios;

enter image description here

I've all of the following~

It's also worth noting that~

enter image description here

enter image description here

I would really appreciate anyone's knowledge on this subject and especially anyone who has previously encountered and dealt with this.

Upvotes: 10

Views: 8481

Answers (3)

Ben Butzer
Ben Butzer

Reputation: 1005

I had this NETSDK1139 problem with my command line build script, and realized I needed to switch from msbuild to dotnet build. I was able to build the app otherwise in Visual Studio 2022 IDE, but not with msbuild. The vstool had replaced mdtool with Visual Studio 2017. A switch to msbuild to replace vstool was necessary with Visual Studio 2022. Now finally dotnet. Old Way

/Applications/Visual\ Studio.app/Contents/MacOS/vstool --verbose build --f --target:Build --configuration:"Distribution|iPhone" --buildfile:{my solution}.sln 

New Way

# vstool replaces mdtool with Visual Studio 2017 
# msbuild replaces vstool with Visual Studio 2022 
msbuild -target:Build "{my solution}.sln" -property:Configuration="Distribution" -property:Platform="iPhone" 

Even newer way with .NET 8 on an arm64 Mac using the master startup project instead of the solution

dotnet build "{my startup project}.csproj" -nologo -property:Platform="arm64" -property:RuntimeIdentifier="ios-arm64" -c "Release" -property:Configuration="Release" -property:Platform="AnyCPU"

Upvotes: 0

FreakyAli
FreakyAli

Reputation: 16499

I had the same issue and the following is what fixed it,

  • Make sure you have the preview feature on your Mac

enter image description here

Upvotes: 29

piotr5
piotr5

Reputation: 11

There is not enough information to provide you just right details to fix but these things I would check first:

  • Do you have latest version of VS?

  • Do you have other versions of VS?

  • Check if you have other workloads.

Check open issues with similar problem. Like there was an issue reported some time ago on github - https://github.com/dotnet/maui/issues/1795

Upvotes: 0

Related Questions