3

I've installed Visual Studio 2022 for Mac and created a .NET MAUI project.

If I start debugging with the Android emulator selected, it starts as expected.

If I switch to an iOS simulator instead, the build works but I get an error saying:

"Can not execute [...]/net6.0-android/MauiSample1.dll. The selected execution mode is not supported for .NET projects."

Notice it says "net6.0-android" in the DLL path...

I tried removing the Android build target in the .csproj file...

<TargetFrameworks>net6.0-ios;net6.0-maccatalyst</TargetFrameworks>

...but that instead gives me a similar error saying:

"Can not execute [...]/net6.0-ios/iossimulator-x64/MauiSample1.exe. The selected execution mode is not supported for .NET projects."

I get a feeling there's something off with what it tries to deploy/start on the iOS simulator?

Screenshot showing iOS simulator is selected, error is at the bottom left:

Visual Studio 2022 for Mac screenshot

PS. Funny thing is, I was able to get the app deployed to the iOS simulator from Visual Studio 2022 on Windows, paired to the Mac over the network...

4
  • Well my guess is either you don't didn't delete the bin obj and when building its trying to build android still or you need to restart your vs so it knows Android was removed from targets Commented Oct 20, 2022 at 15:26
  • Well, I shouldn't need to remove the target, the project should target both iOS and Android. Commented Oct 20, 2022 at 15:36
  • I'm going to download the 17.4 preview of VS 2022 for Mac to see if that helps. Commented Oct 20, 2022 at 15:48
  • Yeah try that if not gimme your version of vs Commented Oct 20, 2022 at 17:21

1 Answer 1

1

Installing Visual Studio for Mac 2022 version 17.4 (as of writing in Preview 4) solved it.

I guess this is why version 17.3 came with a warning about .NET MAUI development not being "officially supported"...

Sign up to request clarification or add additional context in comments.

5 Comments

I am getting this behaviour in 17.4.1
Same on 17.5.2 Stable and 17.6 Preview.
And same in 17.5.4
I had the same behavior in 17.5.4, but it's because I tried to run the app in a Release configuration. In a Release configuration, you can run the app by clicking on "Start Without Debugging" under the "Debug" menu tab.
I am running 17.6.3 (build 421) and I am getting the same behavior. This only started for me AFTER I added custom build configurations, however.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.