0

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.

Community
  • 1
  • 1
user2934433
  • 343
  • 1
  • 5
  • 20
  • Have you reviewed [this blog post](https://blogs.msdn.microsoft.com/devops/2016/05/03/versioning-nuget-packages-cd-1/)? – techvice Jan 26 '18 at 17:56
  • I did but I could not see anything related to build number as automatic versioning, tell me if I missed something – user2934433 Jan 26 '18 at 18:32
  • 1
    Can you reproduce this issue with a new build definition? Can you share the detail log on the OneDrive? (Set system.debug variable to true) – starian chen-MSFT Jan 29 '18 at 05:58
  • Based on the log, the build number is 2.0.1-OnPremServicingFargo.28. What's the result if you try it with a new build definition? BTW: I can't access your VSTS. – starian chen-MSFT Jan 30 '18 at 03:20
  • When I try to create a new build even though the build number changes nuget gets versioned as 2.0.1 and nuget publish fails since it is same version. What I am really looking to get is a unique version from build number. May be like 2.0.1.28 and more over I am not clear by the build number is not $(BuildDefinitionName)_$(Year:yyyy).$(Month).$(DayOfMonth)$(Rev:.r). – user2934433 Jan 30 '18 at 03:36
  • What's the build number of new build definition? – starian chen-MSFT Jan 30 '18 at 05:15
  • Based on the build log, the build number has been updated after building the solution. What's the detail code of each project file (e.g. Servicing.csproj, OnPremServicing.Tests.csproj ...) – starian chen-MSFT Jan 30 '18 at 05:30

1 Answers1

1

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.

starian chen-MSFT
  • 33,174
  • 2
  • 29
  • 53