.NET MAUI project fails to run in Visual Studio Code on Mac

Sreejith Sreenivasan 1,001 Reputation points
2025-05-16T14:57:49.0366667+00:00

I'm trying to run a .NET MAUI project using Visual Studio Code on a Mac to a simulator, but I keep encountering the following error:

error : clang++ exited with code 1

error : ld: building for 'iOS-simulator', but linking in object file

Here’s what I’ve done so far:

  • Installed Xcode and accepted the license agreement
  • Installed necessary workloads using dotnet workload install maui
  • Using macOS 15.5 (24F74)
  • Using Xcode 16.3
  • Opened the project in VS Code and tried to run it using dotnet build

Despite this, I still get the clang++ exited with code 1 error, and I can't figure out what’s causing it. I’ve tried cleaning the project and rebuilding, but no luck.

How can I fix this issue.

Developer technologies .NET .NET MAUI
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Bruce (SqlWork.com) 77,686 Reputation points Volunteer Moderator
    2025-05-16T16:12:04.8+00:00

    the default generated project builds iOS and android. you might set you project to iOS only. in the project file, change the target:

    <TargetFrameworks>net9.0-ios</TargetFrameworks>

    in visual studio code, in debug, select ".net maui" (if not in list add config .net maui). on the bottom right click on {} and select simulator you want. then click on run.

    note: be sure you installed the correct dotnet sdk for your hardware. type "dotnet --info" and check the architecture matches.


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.