How to auto increment pre release nuget package versions?

Hi,

I have setup octopus deployment pipeine for a active development project. Whenever there is a change build runs and it creates a nuget package in Teamcity. I added the nuget version parameter as 1.0.0-rc000%build.number%, problem is it is picking correct latest version whenever it creates a release automatically till build.number 9. After that It still treats build number 10,11,12 etc has less than 9 and it still picks nuget package with rc version 9 whenever it creates a octopus release. What is the current way to handle this situation, I have to deploy code to development environment whenever there is a change. How should I version the nuget packages ? Please guide me on how to fix this.

Thanks,

Ram

Hi Ram,

When you create a release for your project, there’s a link to choose a specific package version, which shows a dialog. Could you attach a screenshot of that dialog showing the incorrect sorting, so we have some examples to work from? The semver ‘tag’ component is sorted alphabetically, but I suspect your version numbers come out as:

1.0.0-rc0009
1.0.0-rc00010
1.0.0-rc00011

Since it is sorted alphabetically, the behaviour you are seeing is expected. You could fix it by changing the numbers to:

1.0.0-rc0009
1.0.0-rc0010
1.0.0-rc0011

Paul

Hi Paul,

Thanks for your reply. Yes you are right, the versions come up as you mentioned.

How do I set this in teamcity to autoincrement in correct order ? Could you please help me with this ?

Attached the screenshot.

Thanks,

Ram

octopus.pdf (24 KB)

Hi Ram,

You’ll just need to change the template in TeamCity so that instead of rc000%build.number%, it’s rc00%build.number%. When you reach package 100, drop another zero. Or, set the build.number to a very high value, like 10000, to start with.

There are some other examples here, but this is really a TeamCity issue - as far as Octopus/NuGet is concerned, we are sorting the packages correctly.

Hope this helps,
Paul