Xamarin跨3个平台的移动应用程序版本号方案 [英] Xamarin mobile app version number scheme across 3 platforms

查看:98
本文介绍了Xamarin跨3个平台的移动应用程序版本号方案的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这里可能存在多个相关的问题.我正在尝试为通过单个xamarin解决方案构建的3个移动应用程序提供一个简单的版本号更新方案.

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版本应自动设置为AssemblyVersion或FileVersion
  • IOS版本号应设置为相同. (不确定内部版本号应该是什么)
  • Android版本名称应设置为相同.
  • Android版本号应针对每个发行版自动递增.

我当前的设置需要导航到4个不同的位置以手动同步版本号.

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

  1. 全球大会信息

我有一个链接文件,其中包含AssemblyVersion和AssemblyFileVersion,该文件由解决方案中的所有PCL和Platform项目共享,并提供以下信息.

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

分别在android项目下,我必须手动更新版本名称和版本号(int)

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

在"iOS应用程序"标签下,我还有2个字段需要填写.

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

在"WMAppManifest属性"对话框的打包"选项卡上,我还必须提供一个版本号.

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

Version Number: 2.1.1.0

推荐答案

我们构建了一个工具来在程序集,Android和iOS之间同步版本;我已经将其推送到我们的GitHub存储库中: https://github.com/soltechinc/soltechxf/.如果您克隆该存储库并构建UpdateVersionInfo,则它应该可以满足您的需求.

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.

默认版本(即,如果不提供任何参数,您将获得的版本)为1.0.0.0.

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

该工具可以使用文件的相对路径或绝对路径,我的建议是采用听起来像您正在使用的方法:将一个version.cs文件包含为链接文件(或包含在链接文件中).共享项目),然后删除该Version.cs文件中包含的所有AssemblyInfo属性.

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.

我应该加上;该工具当前假设您将要更新iOS和Android项目以及C#代码. (我只是给自己添加了便签纸,以使其成为可选内容.)

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.)

刚注意到安迪过去已经注意到并处理好了(这很令人惊讶;我通常对安迪过去大喊大叫...).如果您未提供Android清单或iOS Info.plist的路径,则会跳过它们.

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.

这篇关于Xamarin跨3个平台的移动应用程序版本号方案的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆