Octopus.Tfs is used for packaging projects and creating releases when using Team Foundation Build service. This ties OctopusTools and OctoPack together into a nice package to allow you to automate the process of creating releases in Octopus Deploy without modifying the build process template.
Install the NuGet package into each of the projects you want to package for deployment. This will:
- Create a targets file at the root of your solution called after.[SOLUTION_NAME].targets
- Create a .deploy folder at the root of your solution and add a few more .targets files
- Import a build script into your project file
As a result, you should see several files added/updated in your Pending Changes window.
TODO
Octopus.Tfs and OctoPack require several MSBuild parameters to be specified as arguments. This can make your command line rather long and messy. To avoid this, you can a file to your .deploy directory called Custom.targets. This file will be picked up by Octopus.Tfs and included in your build.
Here's one I prepared earlier -
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<OctopusServerUrl Condition="'$(OctopusServerUrl)' == ''">http://deploy.mydomain.com</OctopusServerUrl>
<OctopusServerApiKey Condition="'$(OctopusServerApiKey)' == ''">API-KEYGENERATEDBYOCTOPUS</OctopusServerApiKey>
<DeploymentProjectName Condition="'$(DeploymentProjectName)' == ''">Project Name in Octopus</DeploymentProjectName>
</PropertyGroup>
</Project>
1.0$(Rev:.r)
- GenerateProjectSpecificOutputFolder - If you are running a version of TFS pre-2013, this needs to be set to true! E.g. /p:GenerateProjectSpecificOutputFolder=true
- CreateRelease - when true will run OctoPack and create the release using Octo.exe. E.g. /p:CreateRelease=true
- OctopusServerUrl - the URL of the Octopus Server. E.g. /p:OctopusServerUrl=http://deploy.mydomain.com
- OctopusServerApiKey - the API Key generated by Octopus Server you will use to push NuGet packages and create releases. E.g. /p:OctopusServerApiKey=API-KEYGENERATEDBYOCTOPUS
- DeploymentProjectName - The Name of the project in Octopus. E.g. /p:DeploymentProjectName="Project Name in Octopus"
These can also be set using the Custom.targets method previously mentioned. However, we recommend you DO NOT ADD CreateRelease TO THE Custom.targets FILE. This should only be specified as a command line parameter as these properties are used on every build.
A full example -
/p:GenerateProjectSpecificOutputFolder=true /p:CreateRelease=true /p:OctopusServerUrl=http://deploy.mydomain.com /p:OctopusServerApiKey=API-KEYGENERATEDBYOCTOPUS /p:DeploymentProjectName="Project Name in Octopus"
Or, using Custom.targets -
/p:GenerateProjectSpecificOutputFolder=true /p:CreateRelease=true