Forum Discussion
Versioning my Maui Android App
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.
- JamesMontemagnoMicrosoft
You should be able to set:
<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
or manually set in your androidmanifest.xmlCheckout https://github.com/xamarin/xamarin-android/blob/main/Documentation/guides/OneDotNetSingleProject.md
- BronzatoCopper Contributor
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
- JamesMontemagnoMicrosoftIn the most recent release candidate the team added back:
```
<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
<ApplicationVersion>1</ApplicationVersion>
```
This will set your versions correct in .NET MAUI
- dannymollerCopper Contributor
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> - LanHuangMicrosoft
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 - KopsRCopper ContributorHi James, i was wondering how I can have different versions between iOS and Android? I had removed the <ApplicationDisplayVersion>1.0.0</ApplicationDisplayVersion> and <ApplicationVersion>1</ApplicationVersion> from the csproj file, and specified a correct value (3.0.0) in the AndroidManifest.xml and Info.plist, but the version still is 1.0.0 on the AppVersion class