Brad Dean

Automate Maui build number when building and deploying

When building and publishing your Maui app you need to specify your version numbers. Here is how to keep them updated automatically every build.

In your .csproj, the Versions are set here:


These are your version and build number.

In iOS Maui will put these in the info.plist as CFBundleShortVersionString and CFBundleVersion.

In Android Maui will put them in AndroidManifest.xml as versionName and versionCode.

You’re free to use whatever you like for these, as long as they increment for each version. The version is a string, the build is an integer. As you can see, the default for a Maui app is the format “Major.Minor.Revision” (1.0.0) and the build is just a single number: 1.

If you submit this to the App Store you’ll be fine with the defaults. However, the second submission will need to either be 1.0.1 (1) or 1.0.0 (2).

Personally, I’m a big fan of using a timestamp for the build number.

There are several benefits:

  • You don’t have to lookup what the last build number was to increment it, you just get the current Unix timestamp and use that
  • It’s easy to automate in every CICD pipeline I’ve ever used (AppCenter, GitHub Actions, DevOps)
  • It’s easy to show on an about screen
  • You can even convert it on an about screen and show “this build is from x hours ago” which is helpful for QA builds

So here is a trick with the new Maui .csproj file: you can have it automatically set the build to a timestamp like this:


Neat, right?

If you want to use some other format you can:


As long as it’s an integer and always increasing in value when you submit it you’re fine. The version above certainly makes it easy to see when a build was created.

For extra credit show this somewhere (your splash screen, an about page). That way when talking to QA or to end users you can make sure everyone is on the same version. Simply set some properties in your view model:

private string version;

private string build;

And then set them in your OnAppearing:

Version = AppInfo.Current.VersionString;
Build = AppInfo.Current.BuildString;

Hope it helps!