I used Xamarin forms but it going to be obsolete so I decided to migrate to Maui. I updated code with assistant and in Android I can build project in emulator but can’t do this in iOS. When I launch VS for MAC I got a message telling me Visual studio Mac will be obsolete in August 2024. So first I don’t know if I can build in VS before august. I also noticed I can’t install latest VS version (I’m using v17)
My issue is when wanting select target device I don’t see any iOS device, I got :
- net-8.0-ios
- net-8.0-android
- net-8.0-maccatalyst
Moreover at the top I got a message telling I’ve not SDK software development installed
Here is my configuration
.NET version : 8.0.301
.NET sdk : 8.0.301, 7.., 6.., 5.., 3..
So here are my questions :
- Can I build in iOS device simulator using VS, if yes why I can’t build my project
- Is there someone able to build with VS or VS code
hope the following informations are sufficient. If you need more info about something I can give you answer.
I also tried to build in vscode but there are some bugs with .NET extension which is not the subject of this topic.
I also tried to create new MAui project to test initial project build and got same issue
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net8.0-android;net8.0-ios;net8.0-maccatalyst</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net8.0-windows10.0.19041.0</TargetFrameworks>
<!-- Uncomment to also build the tizen app. You will need to install tizen by following this: https://github.com/Samsung/Tizen.NET -->
<!-- <TargetFrameworks>$(TargetFrameworks);net8.0-tizen</TargetFrameworks> -->
<!-- Note for MacCatalyst:
The default runtime is maccatalyst-x64, except in Release config, in which case the default is maccatalyst-x64;maccatalyst-arm64.
When specifying both architectures, use the plural <RuntimeIdentifiers> instead of the singular <RuntimeIdentifier>.
The Mac App Store will NOT accept apps with ONLY maccatalyst-arm64 indicated;
either BOTH runtimes must be indicated or ONLY macatalyst-x64. -->
<!-- For example: <RuntimeIdentifiers>maccatalyst-x64;maccatalyst-arm64</RuntimeIdentifiers> -->
<OutputType>Exe</OutputType>
<RootNamespace>MauiApp1</RootNamespace>
<UseMaui>true</UseMaui>
<SingleProject>true</SingleProject>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<!-- Display name -->
<ApplicationTitle>MauiApp1</ApplicationTitle>
...
2
Answers
I decided to reinstall visual code mac and decided to create blank project. During the creation, Visual studio ask me some infos like .NET sdk version and I noticed there was 2 .NET version (6 and 7 and 8 not installed) but .NET was installed on my MAC when I tried
dotnet --list-sdks
so in forum I saw by default Visual Studio disabled .NET 8 so I just needed to enable it in the optionsSOLUTION Go in Visual Studio preferences -> you have a new window with tabs, you should have "Other" and find "preliminary feature" and click in first radio button called "Use .NET 8. development kit software ..."
I believe you might need to enable preview features within the Visual Studio Mac settings to work with .NET 8. This is because .NET was in preview when the last version of it was released.
Within VS MAC, go to Preferences > Other > Preview Features. Check the box to use the .NET 8 SDK if installed.
On another note, I vaugley remember having problems with the .NET SDKs I’d installed outside of visual studio, when first switching to it from VSCode.