Skip to main content
On this page

Build iOS Projects on Windows: Debug, Release and .ipa Output

Debug versus Release, choosing a scheme, target and configuration, overriding build settings, where build products go, when you get an .ipa and when Swift package dependencies resolve.

Last updated

To build iOS projects on Windows, use Build in VS Code or kxbuild build on the command line; both do the same thing. They compile, link, sign and package using the project's schemes, configurations and build settings, so existing .xcodeproj and .xcworkspace files work unchanged. The default is Debug. For an iOS app, a Release build with --export app-store (in VS Code, KXBuild: Build for App Store (.ipa)) gives an App Store-ready package at build\<App>.ipa in the project folder. For every option, see the kxbuild command reference.

> kxbuild build .\MyApp.xcodeproj -s MyApp -c Release --export app-store

How do I choose a scheme, target and configuration?

You can build a .xcodeproj, a .xcworkspace or a folder with a Package.swift. Without a scheme or target, KXBuild builds the default scheme. The configuration defaults to the scheme's Run configuration, or Debug if there isn't one. To list a project's schemes, targets and bundle IDs, run kxbuild project info.

OptionVS CodeCommand line
ProjectThe startup project in the KXBuild viewFirst argument
Scheme / targetThe startup project's default scheme. With several targets you're asked to pick one. Build on a target node builds just that target.-s NAME / -t NAME. Add --ignoreDependence to skip dependencies.
ConfigurationThe Build configuration node in the KXBuild view or KXBuild: Select Build Configuration-c Debug|Release or a custom configuration name
SDK / architectureAlways iphoneos · arm64--sdk, --arch

What's the difference between Debug and Release builds?

DebugRelease
Use forBreakpoint debugging on a deviceTestFlight, the App Store or Ad Hoc distribution
OptimizationOff, so breakpoints land where you expectOn, so breakpoints can jump around
CertificateUsually Apple DevelopmentApple Distribution for App Store submission. Add --export app-store to sign with it and the App Store profile.
.ipaNot by default. Add --ipa PATH to get one.Written to build\<App>.ipa for iOS apps by default. --no-ipa turns it off.

How do I override build settings for one build?

-D KEY=VALUE overrides any build setting for one build. You can repeat it, and it takes the same precedence as KEY=VALUE in xcodebuild. --xcconfig FILE applies a whole file at once.

> kxbuild build .\MyApp.xcodeproj -c Release -D CODE_SIGN_IDENTITY="Apple Distribution" -D DEVELOPMENT_TEAM=ABCDE12345
> kxbuild build .\MyApp.xcodeproj -D MARKETING_VERSION=1.2.0 -D CURRENT_PROJECT_VERSION=45

For permanent changes, edit the project file itself in the Project Settings Editor.

Where do build products go when I build iOS projects on Windows?

ProductLocationNotes
.app and intermediates~\DerivedData\<ProjectName>-<hash>\--derivedDataDir DIR changes the root. --clean empties it before building.
.ipa<project folder>\build\<App>.ipaWritten by default for iOS apps. Configurations other than Release are named <App>-<Config>.ipa. -o, --ipa PATH sets the path, and --no-ipa turns it off.

In WSL, keep the project on the Linux side. Under /mnt/c, builds are an order of magnitude slower.

How do I check that code compiles for the simulator SDK?

Use --sdk iphonesimulator to check that your code compiles for the simulator. Simulator builds are usually unsigned.

> kxbuild build .\MyApp.xcodeproj --sdk iphonesimulator -D CODE_SIGNING_ALLOWED=NO

When are Swift package dependencies resolved?

If the project uses Swift packages, they're resolved automatically before the build. To force a fresh resolve, like Xcode's Reset Package Caches, run

> kxbuild project resolve .\MyApp.xcworkspace --force

In CI, add --only-use-versions-from-resolved-file to stick strictly to Package.resolved, and --skip-package-updates to avoid contacting remote repositories. Both build and resolve accept them.

How do I compile Metal shaders?

If the project contains .metal files, install Apple's Metal Developer Tools for Windows first. The download requires signing in with an Apple Account, so doctor can't install it for you. Download it once yourself. Linux has no Metal compiler, so build these projects on Windows.

Open the Apple downloads page, sign in, download the latest Metal Developer Tools for Windows in the list and install it with the default options. See Metal developer tools for what's included. Then just build. KXBuild finds the tools on its own, with no PATH changes needed.

How do I install on my iPhone right after building?

> kxbuild build .\MyApp.xcodeproj --install

After a successful build, this installs the signed app on the connected iPhone. With several connected, it uses the first one. In VS Code the equivalent is Build & Run, which also attaches the debugger. See Run and debug.

Which command combinations are most common?

GoalCommand
Install a Debug build on the iPhonekxbuild build .\MyApp.xcodeproj --install
Release .ipa for the App Storekxbuild build .\MyApp.xcodeproj -c Release --export app-store
Debug .ipa at a path of your choice, to send to testerskxbuild build .\MyApp.xcodeproj --ipa D:\out\MyApp-dev.ipa
Build only one library targetkxbuild build .\MyApp.xcodeproj -t MyKit --ignoreDependence
Check that it compiles, without signingkxbuild build .\MyApp.xcodeproj -D CODE_SIGNING_ALLOWED=NO

These commands are the same on Windows, Linux and macOS. For scripts and CI, see the kxbuild command reference. Once you build iOS projects on Windows and have an App Store .ipa, publish to the App Store from Windows to upload it and submit for review.

Next steps