Xamarin.iOS build options

Xamarin IDE provides very useful build options for iOS and Android, Here we discuss build options available for iOS. It can be configured with various configuration and platforms. Here I am just considering it for only two configurations and platform, but you can make it as per your choice. The configuration that I consider here is Debug and Release and Platform are simulator and Device.

Notes: Some of the build options are not selectable for debug configuration.

What is build option and what is the use of it?

Build options is predefined rules or configuration that can be used while making an application build or in other words we can call it, a set of rules that can be applied while building the application. It is used to reduce build time, app size, increase app performance etc.

How to open build option for Xamarin.iOS app?

You can open build option by double click on iOS project or right click on it select Option in Visual Studio for Mac and Properties in Visual Studio for Windows, and then select iOS build option from the left panel. You can change build options for each available configuration and platform. For more detail about how to change and add build configuration and platform check this: https://blog.xamarin.com/demystifying-build-configurations/

See attached picture for Configuration and Platform options (screenshot from Visual Studio for mac).

Understanding build options

As shown in above picture there are many build options available, each has different usage and benefit, some of them may be not available in some configuration and platform.

SDK Options: This lets you select the iOS SDK version installed on your system to be used to build your app.

Linker Behaviour: When building your application, Visual Studio for Mac or Visual Studio calls a tool called mtouch that includes a linker for managed code. The linker can strip out the unused code to reduce the overall size of the application. The linker uses static analysis to determine the different code paths that your application is susceptible to follow. It’s a bit heavy process so it takes time while compiling, as it has to go through every detail of each assembly, to make sure that nothing discoverable is removed. The linker behavior can be customized by selecting options from the available options. There are main three options offered by Xamarin which are explained below.

Don’t Link: Selecting this options means the linking step will be skipped and no code will be removed. This will result in faster build process but will produce a heavier IPA. This makes sense to be used when building the app because as a developer you care about less time spent on building the app

Link Framework SDK only: This option will leave your current application assembly untouched, and reduce the size of the assembly shipped with Xamarin.iOS (Xamarin.iOS SDK) by removing everything that is not used by your application. This option is best suited when you target platform to iOS devices. The difference between this and ‘Link All’ option is that it cannot perform few optimization.

Link All: When setting this mode, the linker can use the whole set of its optimizations to reduce the application as small as possible. It will perform linking operation on user code as well which modify user code, so it may break sometimes when your code uses a feature in a way that linker’s static analysis does not detect (for web services, reflection or serialization). It might be required some changes in code to make application link everything. You can find some more detail about linking and linker safe code from here: https://developer.xamarin.com/guides/ios/advanced_topics/linker/

Supported Architectures: This option specifies that on which devices app can run. It has many options as per processor architecture. Each is listed below with device names.


- iPhone 3GS, 4, 4s.

- iPad 1, 2, 3, Mini.

- iPod 3, 4, 5th Generation.


- iPhone 5.

- iPhone 5c.

- iPad 4.

ARMv64 (iOS v8.6 support ARMv64).

- iPhone 5s.

- iPhone SE.

- iPhone 6, 6s, 6+, 6s+,

- iPhone 7, 7+.

- iPad Air, Air 2.

- iPad Mini 2, 3, 4.

- iPad Pro (all).

ARMv7 + ARMv7s.

ARMv7 + ARMv64.

ARMv7s + ARMv64.

ARMv7 + ARMv7s + ARMv64.

ARMv64 is 64-bit architecture it is supported starting with A7 Processor which was introduced with iPhone 5s.

ARMv7s is only supported by the A6 processor which was power the iPhone 5 and run on iOS 6.0 or later.

ARMv7 is supported by all the iPads and iPhones beginning with iPhone 3GS and is meant for iOS 5.0 and later. It will compile smaller and faster code then ARMv6 (ARMv6 support iPhone (original), 3, iPod 1, 2 generation).

ARMv6 is the most compatible architecture which will run on all the iOS devices, but it is only supported by iOS compiler that shipped with Xcode 4.4 or earlier (with latest Xamarin.ios version ARMv6 is not available in option).

Note: Specifying multiple architectures allows the application to target on the widest range of devices with maximum code optimization, but it will double or triple the size of the application executable.

HttpClient Implementation: This option specifies how HttpClient Implementation uses by the application. There is 3 option which is as follow.

Managed: This is fully managed HttpClient handler that has been shipped with the previous version of Xamarin. It has the most compatible feature set with Microsoft .NET and older Xamarin versions. Some of the disadvantages of this options are listed below.

- It is not fully integrated with the Apple OSes and is limited to TLS 1.0.

- It typically much slower at things like encryption than the native APIs.

- It requires a more managed code, thus creating a larger app distributable.

CFNetwork (iOS 6+): The CFNetwork-based handler is based on the native CFNetwork framework available in iOS 6 and newer.

Some of the advantages and disadvantages for this handler as follow.

Pros :

- It uses native APIs for better performance and smaller executable size.

- Supports for newer standards such as TLS 1.2.

Cons :

- Requires iOS 6 or later.

- Not available on watchOS.

- Some HttpClient features/options are not available.

NSUrlSession (iOS 7+): The NSURLSession-based handler is based on the native NSUrlSession framework available in iOS 7 and newer. Some of the advantages and Disadvantages are listed below.

Pros :

- It uses native APIs for better performance and smaller executable size.

- Supports for the latest standards such as TLS 1.2.

Cons :

- Requires iOS 7 or later.

- Some HttpClient features/options are not available.

LLVM Optimizing Compiler: It produces both faster and tighter code than the Mono engine does, at the cost of long compile times. This option does not available in debug configuration because it required more times to compile. It is good to enable this option when you create release build or app store deployment, otherwise, use Mono code generation engine as it will let you iterate quickly. There is one option inside this called “Thumb-2 Instruction set for ARMv7 and ARMv7s”, as the name suggests it is supported on ARMv7 and ARMv7s devices. it is a more compact instruction set used by ARM processors. It can reduce the size of your executable, at the expense of slower execution times.

Perform 32-bit float operation as 64-bit float: As the name suggests, perform all the 32-bit float arithmetic operation as the 64-bit float which yields the higher bit precision and stricter .net compatibility, but it is substantially slower.

Enable Incremental builds: This is used for the development build. It tells IDE to rebuild only components that are changed since the previous build, instead of rebuild whole project. Check this option for faster rebuild and deployment during development, and uncheck this before publishing.

Use the concurrent garbage collector: Concurrent garbage collection perform collections on the old generation (what we call major collections) mostly concurrently with your application — it happens at the same time as your program is running. When the major collection is completed, the collector only needs to pause the Mono threads for a very brief period of time at the end.

So enabling this option can reduce the pause times for major collection, which improves the performance and responsiveness but it can slightly increase memory usage.

Enable device-specific builds: This can be used to improve deployment time by targeting only currently selected iOS device. Selecting this option means that Xamarin will only build for the particular device which selected in device drop-down, it won’t build for all architectures possible for any devices, but only for the architectures of the currently selected device which can speed up build time dramatically. This should not be used for release build configuration.

Additional mtouch arguments: You can use this option to specify some additional mtouch command, which passed to application bundling tools. For example, if you want to skip linking on System.Runtime assembly when you select LinkAll option in link behavior, just pass “ — linkskip=System.Runtime;”. For more detail about mtouch see here: http://docs.go-mono.com/?link=man%3amtouch(1)

Optimize PNG Images: This option uses Apple’s modified PNGCrush utility to optimize PNG images by byteswap image data from RGB(A) to BGR and premultiply alpha component to make image loading faster on iOS devices. More detail for PNGCrush for mac found here : http://osxdaily.com/2013/08/15/pngcrush-mac-os-x/.