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 Octo.exe (Recommended)
Octo.exe 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 user to include a call to
Octo.exe 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.
Octo.exe 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
Octopus 2.6 introduced Lifecycles and Automatic Release Creation. You can use these two features to automatically deploy to one or more environments when a new package is pushed to the built-in NuGet repository.
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 Octopus 3.X.