Based on an idea of https://github.com/soltechinc/soltechxf/
// http://stackoverflow.com/questions/27058172/xamarin-mobile-app-version-number-scheme-across-3-platforms
UpdateVersionInfo is basically a command line tool, that increments the revision number of a version.
It was created to update synchronously all the versions of the different projects in a Xamarin.Forms, now Maui, solution, but since there UpdateVersionInfo evolved pretty much. We added more project types. Now (nearly) all the platforms covered by Xamarin.Forms are covered (UWP, Android, iOS, WPF, Mac, Nuggets). Yes, we missed Tizen. We don’t use it, so we hadn’t any use for it. Remember, UpdateVersionInfo is open source, so feel free to make a pull request for the Tizen implementation or anything else.
name | platforme | file |
---|---|---|
FileProcessor_Droid | Android | AndroidManifest.xml |
FileProcessor_iOS | iOS | Info.plist |
FileProcessor_UAP | UAP | Package.appxmanifest |
FileProcessor_VersionInfo | master | VersionInfo.cs |
Work in progress: iOS ToDo: Mac, WPF
You could ask the question, why the hell there are two projects for although one would have been fine. At the beginning, when we (ChM40 and me) took UpdateVersionInfo out of the box where it was sleeping for several years now, the idea was to integrate it to VS-LittleHelpers. But finally nobody had the time to progress on this subject. So as the versioning question was more and more urgent we splitted the repository so that UpdateVersionInfo could live its own live.
But we still have in mind to reunite the two. So UpdateVersionInfo contains basically the command-line UI whereas UpdateVersionInfo.Core is the operational part we'll try to integrate it to VisualStudio on Windows and Mac in the future ...
There are some administrational tools that scan the command line and global prepare the work. The real stuff is done in the "modules". There is one for every platform and they have all the same three functions: ??? verify, getversion, update ??? ...
state | module name | platforme | file / ext | remarques |
---|---|---|---|---|
OK | _VI_Helper | "params" | VersionInfo.cs | |
-- | AppleHelper | MacOS | Info.plist | TBD |
OK | DeployProjectHelper | WPF, ... | .vdproj | |
? | DroidHelper | Andoid | ||
? | iOSHelper | iOS | Info.plist | |
OK | NugetHelper | Nugets | .Nuspec .csproj |
|
OK | UWPHelper | UWP | Package.AppxManifest |
The version in VersionInfo.cs
is the version we use as base when -v=auto
// Generated by UpdateVersionInfo 1.0.4
//# 1.1.10.10
//# 31.01.2020
using System;
namespace ZPF
{
public static class VersionInfo
{
public static string sVersion { get => "1.1.10.10"; }
public static Version Version { get => new Version(sVersion); }
public static string BuildOn { get => DateTime.Now.ToString("31.01.2020"); }
public static int RevisionNumber { get => Version.Revision; }
}
}
You should not touch anything else than the version in the second line. Everything after the comment block is generated.
UpdateVersionInfo - V2.0.27 alpha (Maui) - 26.11.2024 00:08
-? Shows help/usage information.
-sim Apply no changes
-i Displays current version info
-s Scan subfolders
-ui Use IVersionInfo interface
-tso Update build TimeStamp Only
-gvi Generate VersionInfo.cs
UpdateVersionInfo.exe -i -p=scan
UpdateVersionInfo - V1.0.0
UWP 1.0.0.11
Droid 1.0.0.11
iOS 1.0
UpdateVersionInfo.exe -v=auto -p=scan
UpdateVersionInfo - V1.0.0
UWP 1.0.0.15 --> 1.0.0.16
Droid 1.0.0.15 --> 1.0.0.16
iOS 1.0.0.15 --> 1.0.0.16
If you wish to use “UpdateVersionInfo” in your Visual Studio workflow and also AppCenter.ms you had to edit manually your project files (.csproj) and add Condition="'$(Configuration)'=='Debug'"
to the build event:
<Target Name="PreBuild" Condition="'$(Configuration)'=='Debug'" BeforeTargets="PreBuildEvent">
<Exec Command="..\..\UpdateVersionInfo -v=auto -vi=$(ProjectDir)VersionInfo.cs" />
</Target>
“UpdateVersionInfo” doesn't work on AppCenter.ms.
“UpdateVersionInfo” is for the moment a Windows exe, so it doesn't work on OSX.
<Target Name="PreBuild" Condition="'$(Configuration)'=='Debug' AND '$(DevEnvDir.Substring(0,1))' == 'C' " BeforeTargets="PreBuildEvent">
<Exec Command="$(SolutionDir)UpdateVersionInfo -v=auto -p=scan" />
</Target>
N:\UpdateVersionInfo -v=auto -p "D:\Software\Projects\audixis.Expertises\Expertises\Expertises\Expertises.UWP\Properties\AssemblyInfo.cs" -a "D:\Software\Projects\audixis.Expertises\Expertises\Expertises\Expertises.Android\Properties\AndroidManifest.xml"
N:\UpdateVersionInfo -v=auto -p "D:\Software\Projects\audixis.Expertises\Expertises\Expertises\Expertises.UWP\Properties\AssemblyInfo.cs" -a "D:\Software\Projects\audixis.Expertises\Expertises\Expertises\Expertises.Droid\Properties\AndroidManifest.xml"
N:\UpdateVersionInfo -v=2.0.0.1 -p "D:\Software\Apps\ZeScanner\ZeScanner\ZeScanner\ZeScanner.UWP\Properties\AssemblyInfo.cs" -t "D:\Software\Apps\ZeScanner\ZeScanner\ZeScanner\ZeScanner.iOS\Info.plist" -a "D:\Software\Apps\ZeScanner\ZeScanner\ZeScanner\ZeScanner.Droid\Properties\AndroidManifest.xml"
set UWP_Path="D:\Software\Apps\ZeScanner\ZeScanner\ZeScanner\ZeScanner.UWP\Properties\AssemblyInfo.cs" set DroidPath="D:\Software\Apps\ZeScanner\ZeScanner\ZeScanner\ZeScanner.Droid\Properties\AndroidManifest.xml"
N:\UpdateVersionInfo -v=auto -p %UWP_Path% -a %DroidPath%
[assembly: AssemblyVersion("1.0.0.0")] [assembly: System.Reflection.AssemblyVersion("[assembly: AssemblyVersion("1.0.0.1")]