Xamarin mobile app version number scheme across 3 platforms

三世轮回 提交于 2019-12-02 22:51:36

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.

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
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!