Search code examples
nuget-packageazure-pipelinesazure-artifacts

VSTS - NUGET creation build number as version


I am setting up a continuous integration of my nuget packgae on VSTS, I am following the steps mentioned here https://learn.microsoft.com/en-us/vsts/build-release/tasks/package/nuget to have build number as nuget version.

I am using 2.* of nuget pack with automatic package Versioning set to use the build number and build number format under options set to $(BuildDefinitionName)_$(Year:yyyy).$(Month).$(DayOfMonth)$(Rev:.r).

But this does not effect my version it always comes to be same 2.0.1

I am unable to understand what additional task has to be done.


Solution

  • The build number has been updated by GitVersionTask. So, disable it by specifying UpdateAssemblyInfo to false.

    <PropertyGroup>
      ...
      <UpdateAssemblyInfo>false</UpdateAssemblyInfo>
      ...
    </PropertyGroup>
    

    Article: GitVersionTask Conditional control tasks.

    If you don’t need to update the version, you can uninstall GitVersionTask package.