Build .NET MAUI iOS Apps on Windows and Debug C# on iPhone
Keep your project as it is. After doctor, use dotnet build, dotnet run and dotnet publish as usual, with C# debugging and hot reload.
Last updated
Build .NET MAUI iOS apps on Windows without changing your project or csproj. After a one-time doctor run, the usual dotnet build, dotnet run and dotnet publish commands build the iOS app, install it on your iPhone and produce an .ipa ready for App Store Connect. Press F5 in VS Code to debug your C# code on the iPhone with breakpoints, stepping, variables and expression evaluation, and use hot reload to apply C# and XAML changes without restarting the app. Plain .NET for iOS projects (dotnet new ios) work the same way.
How do I set up .NET MAUI for iOS on Windows?
1. Install the .NET SDK and the MAUI workload
Install the .NET 11 SDK from the .NET website, then open a terminal as administrator and install the MAUI workload.
> dotnet --version> dotnet workload install mauiInstall the C# extension (or C# Dev Kit) from the VS Code Marketplace to write C# and XAML.
2. Create a project
If you don't have a project yet, create one with dotnet new.
> dotnet new maui -n MyMauiApp -o D:\work\MyMauiAppFor an existing or new project, use File → Open Folder in VS Code to open the folder that holds the csproj, or drag the folder into VS Code.
3. Run doctor
Do this before your first build. You only do it once for all your .NET projects. Run it again after you install a new .NET SDK.
In the title bar of the KXBuild view, open the ··· menu and run Doctor (fix environment).
> kxbuild doctorHow do I debug .NET MAUI C# code on an iPhone and use hot reload?
4. Write code
The C# extension gives you completion, go to definition and error checking for C# and XAML.
5. Debug
Select it in the KXBuild view, open any C# file and press F5. In C# you can set breakpoints, conditional breakpoints and exception breakpoints, step into and out of async methods, inspect locals, collections and object properties, evaluate expressions and call methods in the Debug Console, and change variable values. To step into framework code, set justMyCode to false in launch.json.
Run the command below in the project folder to build the app, install it on your iPhone and launch it. With several devices connected, add --device <UDID> to pick one.
> dotnet run -f net11.0-ios -r ios-arm646. Hot reload
Hot reload needs the iPhone connected with a cable. Once the app is running, edit code inside a C# method or a XAML file and save. The change shows up on the phone right away and the page keeps its state. When a change is too large to apply live, the app is rebuilt and restarted automatically.
Click the flame button in the KXBuild view title bar, or run KXBuild: Hot Reload (.NET) from the Command Palette.
> dotnet watch -f net11.0-ios -r ios-arm64Before you connect a phone for the first time, install and open Apple Devices from the Microsoft Store to get the USB driver on Windows. On iOS 16 and later, turn on Developer Mode in Settings > Privacy & Security and let the phone restart. See connect an iPhone to Windows for the full steps.
How do I build a .NET MAUI iOS app as an .ipa on Windows?
7. Release
Run the command below in the project folder to get an .ipa in bin\Release\net11.0-ios\ios-arm64\publish. To upload it to App Store Connect, see publish to the App Store from Windows.
> dotnet publish -f net11.0-ios -r ios-arm64 -c ReleaseApps are signed with your own certificate. Put your .p12 certificate and .mobileprovision profile in the keychain certificate folder, and each build picks them by the ApplicationId in your csproj. Use an Apple Development certificate for debugging and an Apple Distribution certificate for the App Store. See sign iOS apps on Windows to get them. Upload with kxstore (kxstore build upload, on Windows, Linux and macOS), then handle TestFlight and review on the App Store Connect website. That way the iOS side of a .NET MAUI app, from coding and debugging on a real iPhone to uploading to the App Store, stays on one Windows computer.
Next steps
Certificates and signing
You can build without a certificate, but you can't install on a device. Put your .p12 and .mobileprovision in the keychain folder and every build signs automatically. Also covers choosing a certificate in the project and overriding it on the command line.
Release and App Store submission
Build Release with a Distribution certificate to get an .ipa, upload it to App Store Connect with kxstore (or Transporter on a Mac), then go through TestFlight and App Review. Ad Hoc and enterprise distribution work the same way.
Don't see your framework?
kxbuild is a general-purpose build toolchain, so if your framework produces an Xcode project, KXBuild can build it. The list above covers common cases only. Tell us about your setup.