Versioning my Maui Android App

%3CLINGO-SUB%20id%3D%22lingo-sub-3017722%22%20slang%3D%22en-US%22%3EVersioning%20my%20Maui%20Android%20App%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3017722%22%20slang%3D%22en-US%22%3E%3CP%3EPreviously%20the%20way%20to%20define%20version%20code%20for%20Android%20in%20Maui%20%3CSTRONG%3E.csproj%3C%2FSTRONG%3E%20file%20was%20like%20this%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-yaml%22%3E%3CCODE%3E%3C!--%20Versions%20--%3E%0A%3CAPPLICATIONVERSION%3E3.1.2%3C%2FAPPLICATIONVERSION%3E%0A%3CANDROIDVERSIONCODE%3E3%3C%2FANDROIDVERSIONCODE%3E%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWith%20the%20new%20release%20of%20Visual%20Studio%20Preview%2C%20this%20has%20changed%20to%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-yaml%22%3E%3CCODE%3E%3CAPPLICATIONVERSION%3E3%3C%2FAPPLICATIONVERSION%3E%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIt%20works%2C%20I%20mean%20I%20can%20bundle%20a%20new%20%3CSTRONG%3E.aab%3C%2FSTRONG%3E%20package%20and%20import%20it%20on%20the%20Google%20Play%20Console.%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Bronzato_0-1638270460170.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F330316iEF4ACC03BF721B25%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22Bronzato_0-1638270460170.png%22%20alt%3D%22Bronzato_0-1638270460170.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Bronzato_2-1638270667736.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F330319i3B929851EA286815%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22Bronzato_2-1638270667736.png%22%20alt%3D%22Bronzato_2-1638270667736.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3EUnfortunately%2C%20when%20imported%20I%20only%20see%20the%20versionCode%20%3CSTRONG%3E3%3C%2FSTRONG%3E%20(which%20is%20defined%20in%20the%20.csproj%20file%20as%20ApplicationVersion).%20What%20about%20the%20versionName%20(in%20parentheses)%20%3F%20Nothing%20is%20planned%20in%20the%20.csproj%20file%20%3F%20When%20imported%20on%20the%20Google%20Play%20Console%2C%20I%20don't%20want%20to%20have%26nbsp%3B%203%20(1.0.0)%20but%20I%20want%203%20(3.1.2)...%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fdeveloper.android.com%2Fstudio%2Fpublish%2Fversioning%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Ehttps%3A%2F%2Fdeveloper.android.com%2Fstudio%2Fpublish%2Fversioning%3C%2FA%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EversionCode%3CSPAN%3E%26nbsp%3B%E2%80%94%20A%20positive%20integer%20used%20as%20an%20internal%20version%20number.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EversionName%26nbsp%3B%E2%80%94%20A%20string%20used%20as%20the%20version%20number%20shown%20to%20users.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-3017722%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3E.NET%20MAUI%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EAndroid%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EBlazor%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
New Contributor

Previously the way to define version code for Android in Maui .csproj file was like this:

 

 

 

<!-- Versions -->
<ApplicationVersion>3.1.2</ApplicationVersion>
<AndroidVersionCode>3</AndroidVersionCode>

 

 

 

With the new release of Visual Studio Preview, this has changed to:

 

 

 

<ApplicationVersion>3</ApplicationVersion>

 

 

 

It works, from Visual Studio, I can bundle a new .aab package (see image below). We see the version code is defined to 3. Unfortunately the version is defined to 1.0.0 and I don't know how to change this.

 

Bronzato_0-1638270460170.png

 

...when imported on the Google Play Console, it look like this:

 

Bronzato_2-1638270667736.png

 

Unfortunately, when imported I only see the versionCode 3 (which is defined in the .csproj file as ApplicationVersion). What about the versionName (in parentheses) ? Nothing is planned in the .csproj file ? When imported on the Google Play Console, I don't want to have  3 (1.0.0) but I want 3 (3.1.2)...

 

https://developer.android.com/studio/publish/versioning

 

versionCode — A positive integer used as an internal version number.

versionName — A string used as the version number shown to users.

 

 

2 Replies

You should be able to set:

 

<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>

 



or manually set in your androidmanifest.xml

 

Checkout https://github.com/xamarin/xamarin-android/blob/main/Documentation/guides/OneDotNetSingleProject.md

@JamesMontemagno thanks for your answer. By adding the code you suggest in my csproj file gives me errors.

 

Bronzato_3-1638636659047.png

 

As soon as I remove this code, the errors disappeared.

Manually set inside my AndroidManifest.xml do the trick but I would have liked to adapt my csproj file.

 

Bronzato_1-1638636359088.png

Bronzato_2-1638636605253.png

 

I'm using Visual Studio Professional 2022 - Preview Version 17.1.0 Preview 1.1