I'm trying to set the Product version as follows:
build-on the days count (1,2,3) but after pipeline execution it is getting overridden by .csproj in Azure DevOps YML script - example:
1.0.20240708.1
This is the Build command am using to accomplish the above.
- name: MSBuildArguments
value: '/p:OutputPath="$(PackagePath)" /p:ProductVersion="$(ProductVersion)" /p:FileVersion="$(fileVersion)" /p:Copyright="$(CopyrightText)" /p:ProductName="$(productname)"'
values came out properly when it was Write-Output
but after pipeline execution, some random values gets generated.
But TFS has the inbuilt property for this to work without any extra commands. Trying to find the similar on azure.
- name: majorVersion
value: 1
- name: minorVersion
value: 0
- name: buildDate
value: $[format('{0:yyyyMMdd}', pipeline.startTime)]
- name: buildCounter
value: $[counter('BuildCounter', 1)]
$ProductVersion = "$majorVersion.$minorVersion.$buildDate.$buildCounter"
build-on the days count (1,2,3) but after pipeline execution it is getting overridden by .csproj in Azure DevOps YML script
For the project targets .NET Core or .NET Standard, if you have productversion defined in csproj, it will take precedence over
the ones passed as MSBuild arguments.
sample below:
After i remove it from csproj, the MSBuild arguments works then. Hence, please try to move the properties from csproj.