Packaging applications when building with team build (xaml-based builds)
When Team Build builds your solution, you will need to package your applications ready to be deployed. This can be done by installing OctoPack on the projects that you plan to deploy.
When defining your build definition, you can expand the Advanced properties to specify custom arguments for MSBuild. At a minimum, you'll need to pass:
There are plenty of other properties that you can pass here. For example, you can tell OctoPack to publish the resulting packages to a file share or another NuGet repository. See the "Publishing a new package to Octopus" section below, or Learn more in the section on OctoPack.
Publishing a new package to Octopus
In most cases, you'll want to push your newly-created package to the built-in Octopus Deploy NuGet repository. To do this, you can use two additional MSBuild arguments to tell OctoPack to publish the package(s).
Built-in Nuget and API keys
To find your Octopus NuGet repository URL, see the Package repositories section.
To create an API key, see the How to create an API key section.
Deploying automatically after a build
Using the Octopus CLI (recommended)
The Octopus CLI is a command line tool built on top of our REST API. Its fairly easy to hook up into almost any process from a simple script. In the case of old XAML-based builds, we recommend you include a call to
octo in the post-deploy script of their build definition, so it gets called after MSBuild ran and Octopack created the package and pushed it to the repository.
The Octopus CLI has plenty of commands, but the ones you should look into for the post-deploy script are:
- Create-Release to create a release in Octopus.
- Deploy-Release to deploy the previously created release.
Using lifecycles and automatic deployments
First, turn on automatic release creation to create a new release when your package is pushed. Then, using the project Lifecycle configure one or more environments in your first phase to deploy automatically when a new release is available.
By adding these features to the steps above, you can set up complete end-to-end continuous integration:
- OctoPack will create new NuGet packages for your projects.
- OctoPack will push those packages to the built-in NuGet repository.
- Automatic release creation will create a new release.
- Your lifecycle will trigger a deployment when the release is created.
This 6 minute video walks through the above steps to create an end-to-end continuous deployment process for Team Foundation Server.
While the video was recorded using Octopus 2.6, it is still valid for modern versions of Octopus.
Need support? We're here to help.