Reputation: 163
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.
(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;
I've all of the following~
It's also worth noting that~
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
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
Reputation: 16499
I had the same issue and the following is what fixed it,
Also make sure that you have the SDK https://dotnet.microsoft.com/en-us/download/dotnet/8.0
Also in my case, I had to reinstall VS MAC (Only do this if needed)
Upvotes: 29
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