Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xamarin mobile app version number scheme across 3 platforms

There's probably multiple questions here all related. I'm trying to come up with a simple version number update scheme for our 3 mobile apps built from a single xamarin solution.

What I'm looking for is a simple way to keep all these values in sync with one another without having to go around and update them all individually.

  • Windows Phone Version should get set to the AssemblyVersion or FileVersion Automatically
  • IOS Version Number should be set to same. (not sure what the build number should be)
  • Android Version Name should be set to same.
  • Android Version Number should auto increment for each release build.

My current setup requires navigating around to 4 different places to manually sync up the version numbers.

  1. Global Assembly Info

I have a linked file which contains the AssemblyVersion and AssemblyFileVersion that's shared by all PCL and Platform projects in the solution with the following info.

[assembly: AssemblyVersion("2.1.1.*")]
[assembly: AssemblyFileVersion("2.1.1.0")]
  1. Android

Seperately under the android project, I have to manually update the version name and version number (int)

Version Name: 2.1.1
Version Number: 2
  1. IOS

Under the iOS Application tab, I've 2 more fields to fill in.

Version Number: 2.1.1
Build Number: 0 //Not sure if I'm using this field correctly.
  1. Windows Phone

On the "Packaging" tab of the WMAppManifest Property dialog, I have to supply a Version Number as well.

Version Number: 2.1.1.0
like image 836
Eoin Campbell Avatar asked Nov 21 '14 09:11

Eoin Campbell


People also ask

Is Xamarin hybrid or cross-platform?

Cross-platform Xamarin is part of the vibrant . NET ecosystem, used by millions of developers worldwide. Share more than 75% of your code across platforms, for "write once, run anywhere" ease. Use your favorite frameworks, tools, and Xamarin's powerful libraries to access native APIs and 2D graphics from shared code.

Is Xamarin being discontinued?

In May 2020, Microsoft announced that Xamarin. Forms, a major component of its mobile app development framework, would be deprecated in November 2021 in favour of a new . Net based product called MAUI - Multiform App User Interface.

How many apps use Xamarin?

This makes Xamarin the technology of choice for 15,000 companies in such fields as energy, transport, media, healthcare, and many more. We are going to look at some outstanding Xamarin app examples further.


2 Answers

We've built a tool to synchronize versions between assemblies, Android, and iOS; I've just pushed it to our GitHub repo: https://github.com/soltechinc/soltechxf/. If you clone that repo and build UpdateVersionInfo, it should do what you're looking for.

UpdateVersionInfo.exe:
  -?                          Shows help/usage information.
  -v, --major=VALUE           A numeric major version number greater than zero.
  -m, --minor=VALUE           A numeric minor number greater than zero.
  -b, --build=VALUE           A numeric build number greater than zero.
  -r, --revision=VALUE        A numeric revision number greater than zero.
  -p, --path=VALUE            The path to a C# file to update with version
                              information.
  -a, --androidManifest=VALUE The path to an android manifest file to update
                              with version information.
  -t, --touchPlist=VALUE      The path to an iOS plist file to update with
                              version information.

The default version (i.e., the version you'll get if you supply none of the parameters) is 1.0.0.0.

The tool can use relative or absolute paths to the files, and my recommendation is to follow the approach it already sounds like you're using: have a single version.cs file that you include as a linked file (or in a shared project), and remove any AssemblyInfo attributes that are contained in that Version.cs file.

I should add; the tool currently assumes that you WILL be updating an iOS and an Android project along with the C# code. (I just added a post-it note to myself to make those optional.)

EDIT: Just noticed that past-Andy already noticed that and took care of it (which is a surprise; I usually yell epithets at past-Andy...). If you do not supply a path for the Android manifest or iOS Info.plist, it will skip them.

like image 91
Andy Hopper Avatar answered Oct 14 '22 02:10

Andy Hopper


You could take a look at xavtool.

Typical flow:

$ xavtool current
1.0.1 - androidApp (...\test\AndroidManifest.xml)
1.0.1 - iOSApp (...\test\Info.plist)
1.0.1.0 - uwpApp (...\test\Package.appxmanifest)

$ git flow release start '1.1.0'

$ xavtool i
1.0.1: New version: 1.1.0 (...\test\AndroidManifest.xml)
1.0.1: New version: 1.1.0 (...\test\Info.plist)
1.0.1.0: New version: 1.1.0.0 (...\test\Package.appxmanifest)

$ git commit -am "Version bump to 1.1.0"
$ git flow release finish -p
like image 37
Gabriel Robert Avatar answered Oct 14 '22 01:10

Gabriel Robert