Skip to content

Automatic Build Versioning

Dan Siegel edited this page Mar 14, 2018 · 1 revision

The Mobile Build tools supports automatically incrementing the Build Version for Xamarin iOS and Xamarin Android projects. This can work EVERYWHERE including your local desktop/laptop. This is however an entirely Opt-In feature!

Automatic Build Versioning supports the following Versioning Environments:

Environment Description
All Versioning will occur on every build.
BuildHost Versioning will only occur if a *Supported Build Host is detected.
Local Versioning will only occur if a *Supported Build Host is not detected.

Automatic Build Versioning supports the following Behavior's:

Behavior Description
Off Automatic Versioning is Disabled
PreferBuildNumber When running on a *Supported Build Host it will use the Build Number, otherwise it will use the current timestamp
Timestamp Automatic Versioning will use the timestamp for the build

* Supported Build Hosts:

  • AppCenter
  • AppVeyor
  • Jenkins
  • VSTS

Configuring Automatic Versioning

To enable Automatic Versioning you will need to open your iOS or Android project edit the main PropertyGroup.

Property Default Value Notes
AutomaticVersionOffset 0 This value will be added to your Version Number
AutomaticVersionEnvironment All By default this will run everywhere
AutomaticVersionBehavior n/a The property must be set to PreferBuildNumber or Timestamp to enable the build task.
<PropertyGroup>
  <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
  <Platform Condition=" '$(Platform)' == '' ">iPhoneSimulator</Platform>
  <ProductVersion>8.0.30703</ProductVersion>
  <SchemaVersion>2.0</SchemaVersion>
  <ProjectGuid>{99D11950-C303-4761-8045-4BCEEACCB226}</ProjectGuid>
  <ProjectTypeGuids>{FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
  <OutputType>Exe</OutputType>
  <RootNamespace>App1.iOS</RootNamespace>
  <IPhoneResourcePrefix>Resources</IPhoneResourcePrefix>
  <AssemblyName>App1.iOS</AssemblyName>
  <NuGetPackageImportStamp>
  </NuGetPackageImportStamp>
  <!-- Enable Automatic Versioning -->
  <AutomaticVersionBehavior>PreferBuildNumber</AutomaticVersionBehavior>
</PropertyGroup>
Clone this wiki locally