Edit

Share via


Build properties for iOS, Mac Catalyst, macOS and tvOS

MSBuild properties control the behavior of the targets. They're specified within the project file, for example MyApp.csproj, within an MSBuild PropertyGroup.

AltoolPath

The full path to the altool tool.

The default behavior is to use xcrun altool.

AppBundleResourcePrefix

The directory where resources are stored (this prefix will be removed when copying resources to the app bundle).

If not explicitly set, this property will inherit its value from the platform-specific resource prefix properties (IPhoneResourcePrefix, MonoMacResourcePrefix, or XamMacResourcePrefix depending on the platform).

Default: "Resources"

AppBundleDir

The ___location of the built app bundle.

AppBundleExtraOptions

Advanced additional arguments for app bundle creation.

The valid set of arguments depend on the platform.

Typically these shouldn't be used unless specified by a Microsoft engineer.

AppIcon

The AppIcon item group can be used to specify an app icon for the app.

The value of the property must point to the filename of an .appiconset (for iOS, macOS and Mac Catalyst) or .brandassets (for tvOS) image resource inside an asset catalog.

Example:

<PropertyGroup>
    <!-- The value to put in here for the "Resources/MyImages.xcassets/MyAppIcon.appiconset" resource would be "MyAppIcon" -->
    <AppIcon>MyAppIcon</AppIcon>
</PropertyGroup>

See also:

ApplicationDisplayVersion

If set, specifies the CFBundleShortVersionString value in the app manifest (Info.plist).

This is a property that supports .NET "Single Project".

See OneDotNetSingleProject for more information.

ApplicationId

If set, specifies the CFBundleIdentifier value in the app manifest (Info.plist).

This is a property that supports .NET "Single Project".

See OneDotNetSingleProject for more information.

ApplicationTitle

If set, specifies the CFBundleDisplayName in the app manifest (Info.plist).

This is a property that supports .NET "Single Project".

See OneDotNetSingleProject for more information.

ApplicationVersion

If set, specifies the CFBundleVersion in the app manifest (Info.plist).

This is a property that supports .NET "Single Project".

See OneDotNetSingleProject for more information.

ArchiveBasePath

The ___location where archives are stored on Windows for a remote build.

The default is: %LocalAppData%\Xamarin\iOS\Archives

Only applicable to iOS projects (since only iOS projects can be built remotely from Windows).

ArchiveOnBuild

If an Xcode archive should be created at the end of the build.

BGenEmitDebugInformation

Whether the bgen tool (the binding generator) should emit debug information or not.

The default behavior is true when the Debug property is set to true.

BGenExtraArgs

Any extra arguments to the bgen tool (the binding generator).

BGenToolExe

The name of the bgen executable (a tool used by binding projects to generate bindings).

The default behavior is to use the bgen tool shipped with our workload.

BGenToolPath

The directory to where the bgen (BGenToolExe) is located.

The default behavior is to use the bgen tool shipped with our workload.

BuildIpa

If a package (.ipa) should be created for the app bundle at the end of the build.

Only applicable to iOS and tvOS projects.

See CreatePackage for macOS and Mac Catalyst projects.

BundleCreateDump

CoreCLR has a command-line utility called createdump to create core dumps if the process crashes. macOS will automatically create crash reports for any App Store apps and make them available to the app developer, so the createdump tool is not useful for many macOS apps, and as such, it's not included in apps by default.

This can be overriden by setting the BundleCreateDump property:

<PropertyGroup>
  <BundleCreateDump>true</BundleCreateDump>
</PropertyGroup>

Note: the createdump tool does currently not work for sandboxed apps (#18961);

Only applicable to projects that use the CoreCLR runtime (which, at the moment of this writing, is only macOS projects).

BundleOriginalResources

This property determines whether resources are compiled before being embedded into library projects, or if the original (uncompiled) version is embedded.

Historically, resources have been compiled before being embedded into library projects, but this requires having Xcode available, which has a few drawbacks:

  • It slows down remote builds on Windows.
  • It won't work when building locally on Windows, and neither on any other platform except macOS.
  • Resources are compiled using the current available Xcode, which may not have the same features as a potentially newer Xcode available when the library in question is consumed.
  • It makes it impossible to have a whole-program view of all the resources when building an app, which is necessary to detect clashing resources.

As such, we've added supported for embedding the original resources into libraries. This will be opt-in in .NET 9, but opt-out starting in .NET 10.

The default value of this property false in .NET 9, and true in .NET 10+.

Note

File an issue if you find that you need to disable this feature, as it's possible that the option to disable it will be removed in future.

CodesignAllocate

The path to the codesign_allocate tool.

By default this value is auto-detected.

CodesignConfigureDependsOn

This is an extension point for the build: a developer can add any targets to this property to execute those targets before the build looks at any of the codesigning properties.

This can for instance be used to disable code signing for simulator builds:

<PropertyGroup>
  <CodesignConfigureDependsOn>$(CodesignConfigureDependsOn);DisableCodesignInSimulator</CodesignConfigureDependsOn>
</PropertyGroup>
<Target Name="DisableCodesignInSimulator" Condition="'$(SdkIsSimulator)' == 'true'">
  <PropertyGroup>
    <EnableCodeSigning>false</EnableCodeSigning>
  </PropertyGroup>
</Target>

CodesignDependsOn

This is an extension point for the build: a developer can add any targets to this property to execute those targets before the app bundle is signed.

Example:

<PropertyGroup>
  <CodesignDependsOn>$(CodesignDependsOn);DoThisBeforeCodesign</CodesignDependsOn>
</PropertyGroup>
<Target Name="DoThisBeforeCodesign">
  <Exec Command="echo This is executed right before the app is signed." />
</Target>

CodesignEntitlements

The path to the entitlements file that specifies the entitlements the app requires.

Typically "Entitlements.plist".

We'll automatically set this to "Entitlements.plist" if such a file exists in the project root directory.

This can be prevented by setting the EnableDefaultCodesignEntitlements property to false.

CodesignExtraArgs

Extra arguments passed to the 'codesign' tool when signing the app bundle.

CodesignKey

Specifies the code signing key to use when signing the app bundle.

CodesignKeychain

The keychain to use during code signing.

CodeSigningKey

Specifies the code signing key to use when signing the app bundle.

Only applicable to macOS and Mac Catalyst apps, but it's recommended to use the CodesignKey property instead (which works on all platforms).

CodesignProvision

Specifies the provisioning profile to use when signing the app bundle.

CodesignResourceRules

The path to the ResourceRules.plist to copy to the app bundle.

CodesignRequireProvisioningProfile

Specifies whether a provisioning profile is required when signing the app bundle.

By default we require a provisioning profile if:

  • macOS, Mac Catalyst: a provisioning profile has been specified (with the CodesignProvision property).
  • iOS, tvOS: building for device or an entitlements file has been specified (with the CodesignEntitlements property).

Setting this property to true or false will override the default logic.

CompressBindingResourcePackage

The native references in a binding projects are copied to the output directory during the build process, next to the binding assembly (into something we call a "binding resource package").

These native references can either be stored compressed inside a zip file (named $(AssemblyName).resources.zip, or as-is, inside a directory named $(AssemblyName).resources.

The CompressBindingResourcePackage property specifies whether to create a zip file or a directory.

The possible values are:

  • auto: automatically decide the best option (currently a zip file is always created, but once Visual Studio supports long paths on Windows, this may change to only zip binding resource packages with symlinks).
  • true: create a zip file
  • false: create a directory

The default is auto.

This also applies to how native references are stored inside NuGets.

Note

In some cases it can be beneficial to force a zip file on iOS as well, especially when there's a framework with files that have long names, because the zip file can sometimes work around MAX_PATH issues on Windows.

CreateAppBundleDependsOn

This is an extension point for the build: a developer can add any targets to this property to execute those targets when creating the app bundle.

Example:

<PropertyGroup>
  <CreateAppBundleDependsOn>$(CreateAppBundleDependsOn);DoThisBeforeCreatingAppBundle</CreateAppBundleDependsOn>
</PropertyGroup>
<Target Name="DoThisBeforeCreatingAppBundle">
  <Exec Command="echo This is executed before the app bundle is created." />
</Target>

CreateIpaDependsOn

This is an extension point for the build: a developer can add any targets to this property to execute those targets when creating an IPA.

Applicable to all platforms that build IPA archives (currently iOS and tvOS).

Example:

<PropertyGroup>
  <CreateIpaDependsOn>$(CreateIpaDependsOn);DoThisBeforeCreatingIPA</CreateIpaDependsOn>
</PropertyGroup>
<Target Name="DoThisBeforeCreatingIPA">
  <Exec Command="echo This is executed before the IPA is created." />
</Target>

CreatePackage

If a package (.pkg) should be created for the app bundle at the end of the build.

Only applicable to macOS and Mac Catalyst projects.

See BuildIpa for iOS and tvOS projects.

DeviceSpecificBuild

If the build should be specific to the selected device.

Applicable to all platforms that support device-specific builds (currently iOS and tvOS).

DeviceSpecificIntermediateOutputPath

The intermediate output path to use when device-specific builds are enabled.

Applicable to all platforms that support device-specific builds (currently iOS and tvOS).

DeviceSpecificOutputPath

The output path to use when device-specific builds are enabled.

Applicable to all platforms that support device-specific builds (currently iOS and tvOS).

DiagnosticAddress

The IP address where dotnet-dsrouter is executing. This is typcially 127.0.0.1 when profiling on the simulator, and the IP address of the machine where dotnet-dsrouter when profiling on a device.

This is the IP address component of DiagnosticConfiguration`.

Implicitly sets EnableDiagnostics to true.

Defaults to 127.0.0.1.

DiagnosticConfiguration

A value provided by dotnet-dsrouter for DOTNET_DiagnosticPorts such as:

  • 127.0.0.1:9000,suspend,connect
  • 127.0.0.1:9000,nosuspend,connect

Note that the , character will need to be escaped with %2c if passed in command-line to dotnet build:

dotnet build -c Release -p:DiagnosticConfiguration=127.0.0.1:9000%2csuspend%2cconnect

This will automatically set the DOTNET_DiagnosticPorts environment variable packaged inside the application, so that the environment variable is set when the app launches.

Implicitly sets EnableDiagnostics to true.

The default behavior is to compute this value from the other diagnostics properties (DiagnosticAddress, DiagnosticPort, DiagnosticListenMode, and DiagnosticSuspend).

If set, any of the other diagnostic properties will be ignored.

DiagnosticListenMode

A value provided by dotnet-dsrouter such as connect or listen, the listening mode component of DiagnosticConfiguration`.

Implicitly sets EnableDiagnostics to true.

Defaults to listen.

DiagnosticPort

A value provided by dotnet-dsrouter such as 9000, the port component of DiagnosticConfiguration`.

Implicitly sets EnableDiagnostics to true.

Defaults to 9000.

DiagnosticSuspend

A value that specifies the startup behavior when profiling an application.

Set to true to suspend the app at startup (waiting for the diagnostics server to connect to the app) or false to launch the app as usual (and connect the diagnostics server to the app later).

This corresponds with the suspend/nosuspend value in DiagnosticConfiguration`.

Implicitly sets EnableDiagnostics to true.

Defaults to false.

DittoPath

The full path to the ditto executable.

The default behavior is to use /usr/bin/ditto.

EmbedOnDemandResources

If on-demand resources should be embedded in the app bundle.

Default: true

EnableCodeSigning

If code signing is enabled.

Code signing is enabled by default for all platforms; this can be overridden with this property.

EnableDefaultCodesignEntitlements

See CodesignEntitlements.

EnableOnDemandResources

If on-demand resources are enabled.

Default: false for macOS, true for all other platforms.

EnablePackageSigning

If the .pkg that was created (if CreatePackage was enabled) should be signed.

Only applicable to macOS and Mac Catalyst.

EnableDiagnostics

Enable components that are required for diagnostics (such as profiling) to work.

It's enabled by default for debug builds (when MtouchDebug or MmpDebug is enabled), but needs to be enabled manually before profiling release builds:

<PropertyGroup>
  <EnableDiagnostics>true</EnableDiagnostics>
</PropertyGroup>

This will increase the app size slightly.

Only applicable when using the Mono runtime (CoreCLR always supports diagnostics, while NativeAOT never does).

EnableSGenConc

Enables the concurrent mode for the SGen garbage collector.

Only applicable to iOS, tvOS and Mac Catalyst (when not using NativeAOT).

EventSourceSupport

When set to false, disables .NET's EventSource support from trimmed applications. Disabling this feature would prevent .NET diagnostic tools like dotnet-counters from functioning, but at the benefit of reduced application size.

Default: set to false when Optimize is set to true (which is the default for Release builds), unless $(EnableDiagnostics) is enabled.

GenerateApplicationManifest

If an application manifest (Info.plist) should be generated.

Default: true

GeneratedSourcesDir

Where the generated source from the generator are saved.

IncludeAllAppIcons

Set the IncludeAllAppIcons property to true to automatically include all app icons from all asset catalogs in the app.

Example:

<PropertyGroup>
    <IncludeAllAppIcons>true</IncludeAllAppIcons>
</PropertyGroup>

See also:

iOSMinimumVersion

Specifies the minimum iOS version the app can run on.

Applicable to iOS; setting this value will set SupportedOSPlatformVersion for iOS projects (only).

IPhoneResourcePrefix

The directory where resources are stored (this prefix will be removed when copying resources to the app bundle).

Applicable to iOS, tvOS and Mac Catalyst projects.

Consider using the unified AppBundleResourcePrefix property instead.

See also MonoMacResourcePrefix and XamMacResourcePrefix.

IpaIncludeArtwork

If artwork should be included in the IPA.

Only applicable to iOS and tvOS projects.

IpaPackageName

Specifies the name of the resulting .ipa file (without the path) when creating an IPA package (see BuildIpa). IpaPackagePath will override this value.

Only applicable to iOS and tvOS projects.

IpaPackageDir

Specifies the directory of the resulting .ipa file when creating an IPA package (see BuildIpa). IpaPackagePath will override this value.

Only applicable to iOS and tvOS projects.

IpaPackagePath

Specifies the path to the resulting .ipa file when creating an IPA package (see BuildIpa).

Only applicable to iOS and tvOS projects.

IsAppExtension

If a project is an app extension.

IsBindingProject

If a project is a binding project.

IsXPCService

If a macOS extension is an xpc service.

Only applicable to macOS projects.

LinkMode

Specifies the link mode for the project (None, SdkOnly or Full).

Applicable to macOS projects, but this property is deprecated, use TrimMode instead.

See also MtouchLink.

LinkWithSwiftSystemLibraries

If set to true, the build will tell the native linker where to find Swift's system libraries.

This is useful when a native library uses Swift somehow, in which case the native linker needs to know where to find Swift's system libraries.

Currently this means these arguments will be passed to the native linker:

  • -L/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/[platform]
  • -L/Applications/Xcode.app/Contents/Developer/Platforms/[platform].platform/Developer/SDKs/[platform].sdk/usr/lib/swift

The exact set of arguments may change in the future.

MacCatalystMinimumVersion

Specifies the minimum Mac Catalyst (iOS) version the app can run on.

Applicable to Mac Catalyst; setting this value will set SupportedOSPlatformVersion for Mac Catalyst projects (only).

MaciOSPrepareForBuildDependsOn

A semi-colon delimited property that can be used to extend the build process. MSBuild targets added to this property will execute early in the build for both application and library project types. This property is empty by default.

Example:

<PropertyGroup>
  <MaciOSPrepareForBuildDependsOn>$(MaciOSPrepareForBuildDependsOn);MyCustomTarget</MaciOSPrepareForBuildDependsOn>
</PropertyGroup>

<Target Name="MyCustomTarget" >
  <Message Text="Running target: 'MyCustomTarget'" Importance="high"  />
</Target>

This property was introduced in .NET 9.

macOSMinimumVersion

Specifies the minimum macOS version the app can run on.

Applicable to macOS; setting this value will set SupportedOSPlatformVersion for macOS projects (only).

MacOSXSdkVersion

The macOS SDK version to use for the build.

Default: automatically detected according to the default version shipped with the selected Xcode.

See also MtouchSdkVersion.

MarshalManagedExceptionMode

Choose how managed exceptions are handled when encountering a native frame during stack unwinding while processing the managed exception.

Valid values:

  • default: Currently, this is throwobjectivecexception.
  • unwindnativecode: This is not available when using the CoreCLR runtime.
  • throwobjectivecexception: Catch the managed exception, and convert it into an Objective-C exception.
  • abort: Abort the process.
  • disable: Disable intercepting any managed exceptions. For MonoVM this is equivalent to unwindnativecode, for CoreCLR this is equivalent to abort.

For more information, see Exception marshaling and MarshalObjectiveCExceptionMode.

MarshalObjectiveCExceptionMode

Choose how Objective-C exceptions are handled when encountering a managed frame during stack unwinding while processing the Objective-C exception.

Valid values:

  • default: Currently, this is throwmanagedexception.
  • unwindmanagedcode: This is not available when using the CoreCLR runtime.
  • throwmanagedexception: Catch the Objective-C exception, and convert it into a managed exception.
  • abort: Abort the process.
  • disable: Disable intercepting any Objective-C exceptions.

For more information, see Exception marshaling and MarshalManagedExceptionMode.

MdimportPath

The full path to the mdimport tool.

The default behavior is to use xcrun mdimport.

MetalLibPath

The full path to the metallib tool (the Metal Linker).

The default behavior is to use xcrun metallib.

MetalPath

The full path to the Metal compiler.

The default behavior is to use xcrun metal.

MetricsSupport

When set to false, disables .NET's Metrics support from trimmed applications. Disabling this feature would prevent APIs such as System.Diagnostics.Metrics from functioning, but at the benefit of reduced application size.

Default: set to false when Optimize is set to true (which is the default for Release builds), unless $(EnableDiagnostics) is enabled.

MmpDebug

Enables debug mode for app bundle creation.

Only applicable to macOS projects.

See also MtouchDebug.

MobileAggressiveAttributeTrimming

This property determines whether numerous attributes that are very rarely needed at runtime should be trimmed away.

This is enabled by default.

Note that while the attributes that are removed are very rarely used, it's technically possible that the removal can change runtime behavior.

For example, System.Xml.Serialization will behave differently if a constructor has the [Obsolete] attribute (which is one of the attributes that are removed). This is low enough risk to justify removing these attributes by default because of the size savings.

The list of attributes that are removed may change in the future, but at the time of this writing (for .NET 10), these are the attributes:

  • Microsoft.CodeAnalysis.EmbeddedAttribute
  • System.CLSCompliantAttribute
  • System.CodeDom.Compiler.GeneratedCodeAttribute
  • System.ComponentModel.EditorBrowsableAttribute
  • System.Diagnostics.CodeAnalysis.DoesNotReturnAttribute
  • System.Diagnostics.CodeAnalysis.DoesNotReturnIfAttribute
  • System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute
  • System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute
  • System.Diagnostics.CodeAnalysis.ExperimentalAttribute
  • System.Diagnostics.CodeAnalysis.FeatureGuardAttribute
  • System.Diagnostics.CodeAnalysis.FeatureSwitchDefinitionAttribute
  • System.Diagnostics.CodeAnalysis.MemberNotNullAttribute
  • System.Diagnostics.CodeAnalysis.MemberNotNullWhenAttribute
  • System.Diagnostics.CodeAnalysis.NotNullIfNotNullAttribute
  • System.Diagnostics.CodeAnalysis.NotNullWhenAttribute
  • System.Diagnostics.CodeAnalysis.RequiresAssemblyFilesAttribute
  • System.Diagnostics.CodeAnalysis.RequiresDynamicCodeAttribute
  • System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute
  • System.Diagnostics.CodeAnalysis.StringSyntaxAttribute
  • System.Diagnostics.CodeAnalysis.SuppressMessageAttribute
  • System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute
  • System.Diagnostics.CodeAnalysis.UnscopedRefAttribute
  • System.ObsoleteAttribute
  • System.Reflection.AssemblyCompanyAttribute
  • System.Reflection.AssemblyConfigurationAttribute
  • System.Reflection.AssemblyCopyrightAttribute
  • System.Reflection.AssemblyDefaultAliasAttribute
  • System.Reflection.AssemblyDescriptionAttribute
  • System.Reflection.AssemblyMetadataAttribute
  • System.Reflection.AssemblyProductAttribute
  • System.Reflection.AssemblyTitleAttribute
  • System.Runtime.CompilerServices.AsyncMethodBuilderAttribute
  • System.Runtime.CompilerServices.CallerArgumentExpressionAttribute
  • System.Runtime.CompilerServices.CallerFilePathAttribute
  • System.Runtime.CompilerServices.CallerLineNumberAttribute
  • System.Runtime.CompilerServices.CallerMemberNameAttribute
  • System.Runtime.CompilerServices.CompilerFeatureRequiredAttribute
  • System.Runtime.CompilerServices.CompilerGlobalScopeAttribute
  • System.Runtime.CompilerServices.EnumeratorCancellationAttribute
  • System.Runtime.CompilerServices.ExtensionAttribute
  • System.Runtime.CompilerServices.InterpolatedStringHandlerArgumentAttribute
  • System.Runtime.CompilerServices.InterpolatedStringHandlerAttribute
  • System.Runtime.CompilerServices.IntrinsicAttribute
  • System.Runtime.CompilerServices.IsReadOnlyAttribute
  • System.Runtime.CompilerServices.IsUnmanagedAttribute
  • System.Runtime.CompilerServices.NativeIntegerAttribute
  • System.Runtime.CompilerServices.RefSafetyRulesAttribute
  • System.Runtime.CompilerServices.ScopedRefAttribute
  • System.Runtime.CompilerServices.SkipLocalsInitAttribute
  • System.Runtime.CompilerServices.TupleElementNamesAttribute
  • System.Runtime.InteropServices.LibraryImportAttribute
  • System.Runtime.InteropServices.Marshalling.ContiguousCollectionMarshallerAttribute
  • System.Runtime.InteropServices.Marshalling.CustomMarshallerAttribute
  • System.Runtime.InteropServices.Marshalling.MarshalUsingAttribute
  • System.Runtime.InteropServices.Marshalling.NativeMarshallingAttribute
  • System.Runtime.Versioning.NonVersionableAttribute
  • System.Runtime.Versioning.ObsoletedOSPlatformAttribute
  • System.Runtime.Versioning.RequiresPreviewFeaturesAttribute
  • System.Runtime.Versioning.SupportedOSPlatformAttribute
  • System.Runtime.Versioning.SupportedOSPlatformGuardAttribute
  • System.Runtime.Versioning.TargetPlatformAttribute
  • System.Runtime.Versioning.UnsupportedOSPlatformAttribute
  • System.Runtime.Versioning.UnsupportedOSPlatformGuardAttribute

This property was introduced in .NET 10.

MonoBundlingExtraArgs

Additional arguments specifying how to create the app bundle.

Only applicable to macOS projects.

This property is deprecated, use AppBundleExtraOptions instead.

MonoMacResourcePrefix

The directory where resources are stored (this prefix will be removed when copying resources to the app bundle).

Only applicable to macOS projects.

Consider using the unified AppBundleResourcePrefix property instead.

See also IPhoneResourcePrefix and XamMacResourcePrefix.

MonoUseCompressedInterfaceBitmap

This directs the Mono runtime to use a compressed version of interface bitmaps (interface bitmaps are used to determine whether a certain types implements a given interface).

These bitmaps can use a significant amount of memory at runtime, in particular for apps that have a substantial amount of interfaces.

This setting is disabled by default, but it can be enabled like this, which will decrease the amount of memory used at runtime:

<PropertyGroup>
    <MonoUseCompressedInterfaceBitmap>true</MonoUseCompressedInterfaceBitmap>
</PropertyGroup>

The downside is that type checks (obj is SomeInterface) will be slower.

Only applicable when using the Mono runtime.

MtouchDebug

Enables debug mode for app bundle creation.

Applicable to iOS, tvOS and Mac Catalyst projects.

See also MmpDebug.

MtouchEnableSGenConc

Enables the concurrent mode for the SGen garbage collector.

Only applicable to iOS, tvOS and Mac Catalyst when not using NativeAOT.

This property is deprecated, use EnableSGenConc instead.

MtouchExtraArgs

Additional arguments specifying how to create the app bundle.

Only applicable to iOS, tvOS and Mac Catalyst projects.

This property is deprecated, use AppBundleExtraOptions instead.

MtouchInterpreter

Enables the interpreter, and optionally takes a comma-separated list of assemblies to interpret (if prefixed with a minus sign, the assembly will be AOT-compiled instead). 'all' can be used to specify all assemblies. This argument can be specified multiple times.

Example:

<PropertyGroup>
  <!-- interpret all assemblies -->
  <MtouchInterpreter>all</MtouchInterpreter>

  <!-- AOT-compile all assemblies, except System.dll, which will be interpreted. -->
  <MtouchInterpreter>System</MtouchInterpreter>

  <!-- interpret all assemblies, except System.Core.dll, which will be AOT-compiled. -->
  <MtouchInterpreter>all,-System.Core</MtouchInterpreter>
</PropertyGroup>

A shorthand for the MtouchInterpreter is to set UseInterpreter=true, which is equivalent to MtouchInterpreter=all.

If both UseInterpreter and MtouchInterpreter are set, then MtouchInterpreter takes precedence.

Applicable to iOS, tvOS and Mac Catalyst apps (when not using NativeAOT).

The default behavior is to not enable the interpreter.

Note

MAUI changes the default by setting UseInterpreter=true for the "Debug" configuration.

Specifies the link mode for the project (None, SdkOnly, Full).

Applicable to iOS, tvOS and Mac Catalyst projects, but this property is deprecated, use TrimMode instead.

See also LinkMode.

MtouchSdkVersion

The iOS or tvOS SDK version to use for the build.

Default: automatically detected according to the default version shipped with the selected Xcode.

See also MacOSXSdkVersion.

MtouchUseLlvm

A boolean property that specifies whether AOT compilation should be done using LLVM.

Applicable to iOS, tvOS and Mac Catalyst projects.

Default:

  • On iOS and tvOS: enabled for Release builds (where Configuration="Release").
  • On Mac Catalyst: never enabled by default.

NoBindingEmbedding

A boolean property that specifies whether native libraries in binding projects should be embedded in the managed assembly, or put into a .resources directory next to the managed assembly.

The default value is true (which means native libraries will not be embeddded in the managed assembly).

Note

Xcframeworks won't work correctly if embedded inside the managed assembly (if this property is not true).

NoDSymUtil

A boolean property that specifies whether .dSYM generation should be disabled.

Default:

  • true for iOS and tvOS when building for the simulator.
  • true for macOS and Mac Catalyst unless creating an archive (ArchiveOnBuild=true)

This means the .dSYM archive will be generated in the following cases (by default):

  • On iOS and tvOS when building for device.
  • On macOS and Mac Catalyst when creating an archive (ArchiveOnBuild=true).

NoSymbolStrip

A boolean property that specifies whether debug symbols are removed from the app at build time.

The default behavior is to keep debug symbols for:

  • Debug builds for desktop platforms.
  • Simulator builds for mobile platforms.

Example to keep debug symbols:

<PropertyGroup>
  <NoSymbolStrip>true</NoSymbolStrip>
</PropertyGroup>

OnDemandResourcesInitialInstallTags

A string property that specifies the initial install tags for on-demand resources.

OnDemandResourcesPrefetchOrder

A string property that specifies the prefetch order for on-demand resources.

OnDemandResourcesUrl

A string property that specifies the resource url for on-demand resources.

OptimizePNGs

A boolean property that specifies whether png images should be optimized.

OptimizePngImagesDependsOn

This is an extension point for the build: a developer can add any targets to this property to execute those targets before any png images are optimized.

Example:

<PropertyGroup>
  <OptimizePngImagesDependsOn>$(OptimizePngImagesDependsOn);MyCustomTarget</OptimizePngImagesDependsOn>
</PropertyGroup>

<Target Name="MyCustomTarget" >
  <Message Text="Running target: 'MyCustomTarget'" Importance="high"  />
</Target>

OptimizePropertyLists

A boolean property that specifies whether property lists (plists) should be optimized.

OptimizePropertyListsDependsOn

This is an extension point for the build: a developer can add any targets to this property to execute those targets before any property lists (plists) are optimized.

Example:

<PropertyGroup>
  <OptimizePropertyListsDependsOn>$(OptimizePropertyListsDependsOn);MyCustomTarget</OptimizePropertyListsDependsOn>
</PropertyGroup>

<Target Name="MyCustomTarget" >
  <Message Text="Running target: 'MyCustomTarget'" Importance="high"  />
</Target>

PackageSigningKey

Specifies the code signing key to sign the package when creating .pkg for a macOS and Mac Catalyst project.

Only applicable to macOS and Mac Catalyst apps.

PackagingExtraArgs

Specifies any extra arguments to pass to the 'productbuild' tool when creating .pkg for a macOS and Mac Catalyst project.

Only applicable to macOS and Mac Catalyst apps.

PkgPackagePath

Specifies the path to the resulting .pkg file when creating a package (see CreatePackage).

Only applicable to macOS and Mac Catalyst apps.

PlutilPath

The full path to the plutil command-line tool.

The default behavior is to use xcrun plutil.

PngCrushPath

The full path to the pngcrush command-line tool.

The default behavior is to use xcrun pngcrush.

ProcessEnums

A boolean property that specifies whether enums should be processed as an api definition in binding projects.

ProductBuildPath

The full path to the productbuild tool.

The default behavior is to use xcrun productbuild.

ProductDefinition

The product definition template (.plist) to be used when creating the product definition to pass to the product build tool when creating packages (.pkg).

Only applicable to macOS and Mac Catalyst apps.

ReferenceNativeSymbol

The item group ReferenceNativeSymbol can be used to specify how we should handle a given native symbol: either ignore it, or ask the native linker to keep it (by passing the symbol as -u ... or in a symbol file to the native linker).

There are two supported types of metadata:

  • SymbolType: either ObjectiveCClass, Function or Field. Used to compute the complete native name of a symbol (for instance, the native symbol for the Objective-C class MyClass is _OBJC_CLASS_$_MyClass, while for a function MyFunction it's just _MyFunction.
  • SymbolMode: either Ignore or not set. Ignore means to not pass the given symbol to the native linker, the default is to do so.

SymbolType is required, while SymbolMode isn't.

Example symbol to keep:

<ItemGroup>
    <ReferenceNativeSymbol Include="MyClass" SymbolType="ObjectiveCClass" />
</ItemGroup>

Example symbol to ignore:

<ItemGroup>
    <ReferenceNativeSymbol Include="MyClass" SymbolType="ObjectiveCClass" SymbolMode="Ignore" />
</ItemGroup>

RequireLinkWithAttributeForObjectiveCClassSearch

We will automatically scan all libraries for managed classes that map to existing Objective-C classes, and then create a native reference at build time for those Objective-C classes.

This way the native linker won't remove these Objective-C classes, thinking they're not used.

However, this can cause a problem if a managed class references an Objective-C class that doesn't exist. The proper fix for this is to remove such managed classes from the build, but this may be cumbersome, in particular if the managed class comes from a binary reference (such as NuGet).

In these cases, it's possible to set the property RequireLinkWithAttributeForObjectiveCClassSearch to true so that we'll only scan libraries with the [LinkWith] attribute for Objective-C classes:

<PropertyGroup>
  <RequireLinkWithAttributeForObjectiveCClassSearch>true</RequireLinkWithAttributeForObjectiveCClassSearch>
</PropertyGroup>

RunWithOpen

This property determines whether apps are launched using the open command on macOS, or if the app's executable is executed directly.

This only applies to macOS and Mac Catalyst apps.

The default value is true. In this mode, the app will be launched by macOS as any other UI application, any stdout/stderr output will be swallowed by macOS, and the dotnet run command will finish as soon as the app has launched.

If set to false, any stdout/stderr output will be printed to the current terminal, and the dotnet run command won't finish until the app has exited.

The following properties can be used to configure the behavior when set to true (i.e. using the open command):

OpenNewInstance

If a new instance will be opened if the app is already running (defaults to false).

This will pass -n to open if set to true.

Example:

$ dotnet run -p:OpenNewInstance=false

OpenArguments

This property can be used to pass additional arguments to the open command.

Example (to set environment variables):

$ dotnet run -p:OpenArguments="--env VARIABLE1=VALUE1 --env VARIABLE2=value2"

Example (to redirect stdout and stderr to a file):

$ dotnet run -p:OpenArguments="--stdout /tmp/stdout.txt --stderr /tmp/stderr.txt"

Run man open to see a list of all the options open accepts.

StandardOutputPath

This property can be used to redirect the stdout output from the app to a file.

Example writing to a file:

$ dotnet run -p:StandardOutputPath=stdout.txt

Example writing to the current terminal:

$ dotnet run -p:StandardOutputPath=$(tty)
[... Console.WriteLine output from app ...]

Note: this can also be accomplished by passing --stdout ... using the OpenArguments property.

StandardErrorPath

This property can be used to redirect the stderr output from the app to a file.

Example writing to a file:

$ dotnet run -p:StandardErrorPath=stderr.txt

Example writing to the current terminal:

$ dotnet run -p:StandardErrorPath=$(tty)
[... Console.Error.WriteLine output from app ...]

Note: this can also be accomplished by passing --stderr ... using the OpenArguments property.

StandardInputPath

This property can be used to redirect the stdin input to the app from a file.

Example:

$ dotnet run -p:StandardInputPath=stdin.txt

Note: this can also be accomplished by passing --stdin ... using the OpenArguments property.

SdkIsSimulator

This property is a read-only property (setting it will have no effect) that specifies whether we're building for a simulator or not.

It is only set after imports and properties have been evaluated. This means the property is not set while evaluating the properties in the project file, so this will not work:

<PropertyGroup>
  <EnableCodeSigning Condition="'$(SdkIsSimulator)' == 'true'">false</EnableCodeSigning>
</PropertyGroup>

However, the either of the following works:

<ItemGroup>
  <!-- item groups (and their conditions) are evaluated after properties have been evaluated -->
  <CustomEntitlements Condition="'$(SdkIsSimulator)' == 'true'" Include="com.apple.simulator-entitlement" Type="Boolean" Value="true" />
  <CodesignConfigureDependsOn>$(CodesignConfigureDependsOn);ConfigureSimulatorSigning</CodesignConfigureDependsOn>
</ItemGroup>
<!-- targets are executed after properties have been evaluated -->
<Target Name="ConfigureSimulatorSigning">
  <PropertyGroup>
    <EnableCodeSigning Condition="'$(SdkIsSimulator) == 'true'">false</EnableCodeSigning>
  </PropertyGroup>
</Target>

Note: this property will always be false on macOS and Mac Catalyst.

StripPath

The full path to the strip command-line tool.

The default behavior is to use xcrun strip.

SupportedOSPlatformVersion

Specifies the minimum OS version the app can run on.

It's also possible to use a platform-specific property:

TrimMode

Specifies the trimming granularity.

The valid options are:

  • full: Trim every assembly.
  • partial: Trim assemblies that have opted into trimming.
  • copy: Trim no assemblies.

See TrimMode for a bit more information about the TrimMode property.

Note

For technical reasons, the trimmer must run for all iOS, tvOS, macOS and Mac Catalyst projects, even if no assemblies are to be trimmed. For this reason, it's not valid to disable trimming by setting PublishTrimmed to false - to disable trimming, set TrimMode=copy instead (a build error will be raised if PublishTrimmed is set to false).

The TrimMode property is equivalent to the existing MtouchLink (for iOS, tvOS and Mac Catalyst) and LinkMode (for macOS) properties, but the valid properties values are different (even though the semantics are the same):

MtouchLink/LinkMode TrimMode
Full full
SdkOnly partial
None copy

Going forward, the MtouchLink and LinkMode properties will be deprecated, please use TrimMode instead.

The default trim mode depends on numerous factors, and may also change in the future.

The current (as of .NET 9) default values are:

  • iOS and iOS: partial when building for device, copy when building for the simulator.
  • macOS: always copy.
  • Mac Catalyst: partial when building for the "Release" configuration, copy otherwise.

Exceptions:

  • The default value is always full when building with NativeAOT.
  • MAUI changes the default value to copy when building for the Debug configuration and the interpreter is enabled using UseInterpreter (which MAUI also enables by default when using the "Debug" configuration).

Note

The default trim mode may change in the future.

tvOSMinimumVersion

Specifies the minimum tvOS version the app can run on.

Applicable to tvOS; setting this value will set SupportedOSPlatformVersion for tvOS projects (only).

UseFloatingTargetPlatformVersion

A boolean property that controls whether library projects should use a floating target platform version or the oldest available platform version.

By default (starting in .NET 10), library projects without an explicit TargetPlatformVersion will use the oldest available reference assemblies for the current .NET version. This ensures maximum compatibility and allows library code to compile against the minimum API surface available for the target framework.

However, this default behavior means that library projects are built differently than executable projects (which use the latest platform version). Code that works in an executable project may not compile when moved to a library project if it uses APIs only available in newer platform versions.

Setting this property to true disables the automatic selection of the oldest platform version, allowing the library project to use the default (latest) platform version like executable projects do.

Example:

<PropertyGroup>
  <!-- Use the latest platform version instead of the oldest -->
  <UseFloatingTargetPlatformVersion>true</UseFloatingTargetPlatformVersion>
</PropertyGroup>

Default: false (use oldest platform version for library projects in .NET 10+).

This property only applies to library projects (OutputType=Library) that are not app extensions and have not specified an explicit target platform version (the target platform version is the optional version number at the end of the TargetFramework property, for example for the TargetFramework net10.0-ios26.0 the target platform version is explicitly 26.0).

This property was introduced in .NET 10.

UseHardenedRuntime

A boolean property that specifies if a hardened runtime is enabled.

Applicable to macOS and Mac Catalyst projects.

UseInterpreter

Enables the interpreter (for all assemblies).

This is equivalent to setting MtouchInterpreter=all.

Applicable to iOS, tvOS and Mac Catalyst apps (when not using NativeAOT).

The default behavior is to not enable the interpreter.

Note

MAUI changes the default by setting UseInterpreter=true for the "Debug" configuration.

See MtouchInterpreter for more information.

UseNativeHttpHandler

Whether the native http handler should be the default http handler or not.

Default: true for all platforms except macOS.

ValidateEntitlements

Choose whether entitlements the app requests should be validated.

Valid values for this property:

  • disable: Validation is disabled.
  • warn: Any validation failures are shown as warnings.
  • error: Any validation failures are shown as errors. This is the default.

The validation process may not validate every entitlement, nor is it guaranteed to not be overeager.

If the validation fails for entitlements that actually work, please file a new issue.

ValidateXcodeVersion

Choose whether the current Xcode version should be validated.

The default value is to validate; set to false to disable.

Note

Using a different than the recommended version is likely to produce problems later on in the build process.

XamMacResourcePrefix

The directory where resources are stored (this prefix will be removed when copying resources to the app bundle).

Applicable to macOS projects.

Consider using the unified AppBundleResourcePrefix property instead.

See also IPhoneResourcePrefix and MonoMacResourcePrefix.

ZipPath

The full path to the zip command-line tool.

The default behavior is to use xcrun zip.