Nov 30 2021 03:16 AM - edited Nov 30 2021 03:22 AM
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.
...when imported on the Google Play Console, it look like this:
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.
Dec 03 2021 01:19 PM - edited Dec 03 2021 01:50 PM
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
Dec 04 2021 08:52 AM
@JamesMontemagno thanks for your answer. By adding the code you suggest in my csproj file gives me errors.
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.
I'm using Visual Studio Professional 2022 - Preview Version 17.1.0 Preview 1.1
Apr 17 2022 10:12 AM - edited Apr 19 2022 02:55 PM
@Bronzato Hey, try this:
<AndroidManifestApplicationName>Your App Name</AndroidManifestApplicationName>
<AndroidManifestApplicationPackageName>com.companyname.your.app.name</AndroidManifestApplicationPackageName>
<AndroidManifestApplicationVersionNumber>4</AndroidManifestApplicationVersionNumber>
<AndroidManifestApplicationVersionName>4.2.1</AndroidManifestApplicationVersionName>
EDIT: This doesn't work, use the normal way of versioning as @JamesMontemagno wrote below: <ApplicationDisplayVersion>4.2.1</ApplicationDisplayVersion>
<ApplicationVersion>4</ApplicationVersion>
Apr 19 2022 02:18 PM
Apr 21 2022 06:54 PM
Hi @Bronzato,
Thanks for posting your issue here.
However this platform is used for how-to discussions and sharing best practices for building any app with .NET.Since your issue is a technical question, welcome to post it in Microsoft Q&A forum, the support team and communities on Microsoft Q&A will help you for any technical questions.
Besides, it will be appreciated if you can share it here once you post this technical question Microsoft Q&A.
Best Regards,
Lan Huang
Apr 29 2022 06:35 AM
May 02 2022 10:51 AM
@JamesMontemagno Thanks. I'm trying to Bump versions in VSTS and getting this error
##[error]unable to find the matched key.
I've enabled the setting that prints the "before" version of the manifest and both android versions are missing, so I'm guessing there is nothing to 'bump'. I have not changed anything significant from the default maui template. Any ideas?