We’re using TeamCity as our CI server, along with OctoPack to generate NuGet packages that get released to Octopus Deploy (using an OctopusDeploy:Release build step).
This is working well for around ten projects, however on one we have the issue illustrated in the attached screenshot.
For this one project, Octopus Deploy is consistently deploying the previous (rather than current) version. The version number is coming from TeamCity, build number configured as 1.0.0.%build.counter%, and then in the NuGet Pack and OctopusDeploy:Release build steps we’re using %build.number% as the version/release number.
Tip: delayed package publishing
NuGet packages created from your build won’t appear in the TeamCity NuGet feed until after the build fully completes. If you plan to trigger a deployment during a build, this creates a problem: the package won’t be in the feed until the build is published, so you won’t be able to deploy it.
The solution is to configure a secondary build configuration, and use a snapshot dependency and build trigger in TeamCity to run the deployment build configuration after the first build configuration completes. The video below demonstrates how to do this.
Based on the above, I force which package I want included in my release at creation by using --packageversion=%build.number% in the TeamCity Release Creation step. That works for me.