Search code examples
azure-devopscommitversioning

Azure DevOps increase VersionPrefix with each commit


Anyone know how increase the VersionPrefix on the .csproj file with each commit?

That property is used to name the package when you push the package on a feed (Nuget push operation)...

2018-11-14T16:15:59.3937162Z ##[error]Error: An unexpected error occurred while trying to push the package with VstsNuGetPush.exe. Exit code(2) and error(The feed already contains 'Lib 1.0.15-alpha'.)


Solution

  • Finally I found a solution. There is a extension on Visual Studio Marketplace, Version number counter that increase a variable defined in Variables Section of the pipeline. Just, define the variable, add a new step (task) on the pipeline of Version number counter and set the variable to increase.

    Finally, you can use $(VariableName) on your code to reference to the Azure DevOps variable. In my case, $(BuildVersionNumber) was enough.

    I hope this help to other people.

    Thanks to Jayendran and Shayki Abramczyk for your answers :)