TeamCity plugin - build, pack and publish in separate steps

Hello,

In a similar to this question - How build and publish to octopus deploy in two separate steps - is there a way to use the TeamCity msbuild plugin to just invoke the “pack” and “publish” from a separate build step? E.g. something like “msbuild /t:octopack,octopublish”

The reason I’m asking is that at present the sequence for the TeamCity MSBuild Runner with the Octopus plugin is as follows:

mysolution.sln
  - first.csproj
    - build
    - octo pack
    - octo publish
  - second.csprj
    - build
    - octo pack
    - octo publish
  - third.csproj
    - build
    - !! build failure !!
- build failed

The downside to this is that the build step will publish first.nupkg and second.nupkg even if the overall build fails.

What I’d prefer instead is:

- build mysolution.sln
  - first.csproj
    - build
  - second.csprj
    - build
  - third.csproj
    - build
  - octo pack
    - first.nupkg
    - second.nupkg
    - third.nupkg
  - octo publish
    - first.nupkg
    - second.nupkg
    - third.nupkg

That way, if the third.csproj build fails it stops before any of packages are published.

From the other answer I linked to, I could just write a bit of PowerShell to find any “obj\octopacked*,nupkg” files and publish the packages myself, but it would nice if this was all bundled up into the shrink-wrapped TeamCity Octopus plugin.

Cheers,

Mike

Hi Mark,

Thanks for getting in touch. That’s correct, if you are using only OctoPack then it will pack and publish each project in turn. You have a couple of alternatives that I can think of, both involve our TeamCity plugin, docs can be found here.

First option is to just remove the publish switch from the MSBuild call and only use /p:RunOctoPack=true. Then add an Octopus Push step from the plugin and use a PackagePath along the lines of **\*.%build.number%.nupkg

The second is to also remove OctoPack and move to using the Octopus Pack step. This may or may not suit your circumstances but is worth mentioning for consideration. I wrote a blog post a while back that was focused on .NETCore builds, but the concepts hold for any build really. You’d just replace the dotnet build tasks with MSBuild based ones.

Hope that helps and please let me know how you get on.

Regards
Shannon

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.