Octopus step in TeamCity selects latest package instead of by version given

During testing I’ve created a lot of packages (up to 0.1.27.0) and then reset the build number counter.
Now facing an error running Octopus step to create and publish a release. Here’s the log:

[11:00:31][Octopus Deploy] Creating Octopus Deploy release
[11:00:31][Octopus Deploy] Octopus Command Line Tool, version 1.1.17.62
[11:00:31][Octopus Deploy]
[11:00:31][Octopus Deploy] Finding project: MyProject
[11:00:31][Octopus Deploy] Handshaking with Octopus server: http://server:8083/api
[11:00:34][Octopus Deploy] Handshake successful. Octopus version: 1.6.1.1718; API version: 2.0.0
[11:00:34][Octopus Deploy] Finding environments...
[11:00:34][Octopus Deploy] Finding steps for project...
[11:00:34][Octopus Deploy] Resolving NuGet package versions...
[11:00:34][Octopus Deploy] - Finding latest NuGet package for step: MyProject
[11:00:34][Octopus Deploy] Release plan for release: 0.1.6.0
[11:00:34][Octopus Deploy] Steps:
[11:00:34][Octopus Deploy] # Name Version Source
[11:00:34][Octopus Deploy] --- ------------------------ --------------- ------------------------------------
[11:00:34][Octopus Deploy] 1 MyProject 0.1.27.0 Latest available in NuGet repository
[11:00:34][Octopus Deploy]
[11:00:34][Octopus Deploy] Creating release...
[11:00:34][Octopus Deploy] Release created successfully!
[11:00:34][Octopus Deploy] ##teamcity[setParameter name='octo.releaseNumber' value='0.1.6.0']
[11:00:34][Octopus Deploy] Successfully scheduled release 0.1.6.0 for deployment to environment Dev
[11:00:34][Octopus Deploy] Deployment has not yet finished. Time taken: 0s
[11:00:44][Octopus Deploy] Deployment has not yet finished. Time taken: 10s
[11:00:54][Octopus Deploy] Command error:
[11:00:54][Octopus Deploy] The task: 'Deploy MyProject release 0.1.6.0 to Dev' failed with the error: A child activity failed: The package could not be downloaded from NuGet. Please see the below errors for details. If you are getting a package verification error, try switching to a Windows File Share package repository to see if that helps.
[11:00:54][Octopus Deploy] Please see the deployment page for more details: http://server:8083/tasks/show/tasks-3427
[11:00:54][Octopus Deploy]
[11:00:54][Octopus Deploy] Octo.exe exit code: 2

Why does it select latest package but not by version given?

Release number in Octopus TeamCity step is configured as %system.build.number%.

Hi,

A project in Octopus can be made up of many packages. So we have two kinds of numbers:

  1. The number for the release in Octopus
  2. The version number for the NuGet packages

You are specifying 0.1.6.0 for the first, but the second part isn’t specified, so Octopus gets it from the latest available packages.

To explicitly specify the package version number to use, use the --packageversion command line parameter in the ‘additional command line arguments’ box. You can find more details here:

Hope that helps,

Paul