Skip to content

ApplicationVersion parameter to dotnet build no longer works #14524

@ckrutsinger

Description

@ckrutsinger

Description

dotnet build -f net7.0-android --configuration Release -v normal --output D:\a\1\a -p:ApplicationVersion=163 -p:ApplicationDisplayVersion=1.0.163
The resulting AAB file has version 1 and display version 1.0 (which is what is in the csproj file), so the command parameters were not used.

This occurred in our Azure pipeline DotNetCoreCLI@2task.

2023-04-12T00:42:51.7415393Z ==============================================================================
2023-04-12T00:42:51.7415540Z Task         : .NET Core
2023-04-12T00:42:51.7415620Z Description  : Build, test, package, or publish a dotnet application, or run a custom dotnet command
2023-04-12T00:42:51.7415748Z Version      : 2.217.0
2023-04-12T00:42:51.7415811Z Author       : Microsoft Corporation
2023-04-12T00:42:51.7415884Z Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/build/dotnet-core-cli
2023-04-12T00:42:51.7415996Z ==============================================================================

Steps to Reproduce

  1. Create a new Maui app.
  2. In the csproj you should have the default <ApplicationDisplayVersion>1.0</ApplicationDisplayVersion><ApplicationVersion>1</ApplicationVersion> values
  3. From command line, dotnet build -f net7.0-android --configuration Release -v normal --output <some file path> -p:ApplicationVersion=163 -p:ApplicationDisplayVersion=1.0.163

Resulting AAB file will use the 1 and 1.0 values instead of the 'p:ApplicationVersion=163 -p:ApplicationDisplayVersion=1.0.163' parameter values.

Link to public reproduction project repository

any project

Version with bug

7.0 (current)

Last version that worked well

6.0.312

Affected platforms

Android

Affected platform versions

not applicable

Did you find any workaround?

Yes, use a task to set version code in Android manifest.

- task: android-manifest-version@1
  displayName: 'Set Android version numbers'
  inputs: 
    sourcePath: 'src/$(projectName)/$(projectName)/Platforms/Android/AndroidManifest.xml'
    versionCodeOption: 'buildid'
    versionCode: $(pipelineBuildNumber)
    versionName: $(pipelineVersionNumber)
    printFile: true

Relevant log output

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-toolingXAML & C# Hot Reload, XAML Editor, Live Visual Tree, Live Preview, Debuggingplatform/androids/needs-infoIssue needs more info from the authort/bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions