Creating Octopus Deploy packages with Visual Studio and Teamcity
In my previous post I’ve talked about creating new projects in Octopus Deploy in order to deploy projects to different environments. In this post I’ll explain a bit on how to create Octopus Deploy packages for your Visual Studio projects via Teamcity.
To enable packaging for Octopus you’ll need to include the Octopack NuGet package to the project you are packaging. In my case this will be the Worker project since I’m only working with Microsoft Azure solutions at the moment.
Once this package is successfully installed you will have to modify the project file also to enforce adding files in the Octopus package.
The following line will have to be added to the propertygroup of your build configuration
<OctoPackEnforceAddingFiles>True</OctoPackEnforceAddingFiles>
For reference, a complete propertygroup:
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<OctoPackEnforceAddingFiles>True</OctoPackEnforceAddingFiles>
</PropertyGroup>
Your project is now ready to start packing. In my case I had to add a nuspec file also, because the worker project contained an application which has to be deployed to on an Azure Cloud Service.
A nuspec file for Octopus Deploy looks exactly the same as one you would create for NuGet itself. Mine looks like this:
<?xml version="1.0"?>
<package xmlns="https://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
<version>$version$</version>
After installing the plugin, three new runner type features will be available when creating a new build step.
Read more →