Setting up a Visual Studio 2013 web application project for Octopus deploy

By | April 1, 2016

Preregisters: Octopus Deploy plugin already installed in TeamCity and Octopus Deploy already setup.

Please note:

  • This guide will not run through setting up deployment steps in Octopus Deploy.
  • Guide is based on setting up a web application in Visual studio 2013.
  • Will not show how to actually replace values in a web.config using a transform config.

 

1) Add nuget package ?OctoPack? to the projects you want to deploy using Octopus. TeamCity will use this package to create the nuget package/s which TeamCity will publish to Octopus.

2) Create a new web.config transform by creating a new build configuration.

To do this in Visual Studio navigate to BUILD > Configuration Manager, in the window which opens click on the ?Active solution configuration:? drop down and select ?<New…>?. In the new window which opens enter the new name such as ?Staging? or ?Development?.

Name the configuration the same as the environments which are or will be set up on Octopus

After creating the new configuration/s right click the web.config you need to add the transform/s for, select ?Add Config Transform?.

For the new files which get added to the project you need to set the ?Build Action? to be ?Content? or they will not be copied when built.

3) Modify the new web.config transforms to match the needs of the environments. E.g. change connection strings, appsettings, service bindings etc.

4) Check the changes in to TFS.

5) If you do not already have generated an API key for your user for Octopus Deploy, or created and set up an Octopus project do this now.

6) Open up TeamCity. If the project is not already created in TeamCity then create it and get it building successfully.

7) In the build solution step check ?Run OctoPack?, this will create the Nuget packages for the projects which you added the Nuget package to.

8) Create a new Octopus Deploy build step, this should be the last step in the order.

The build step needs to be runner type ?Octopus Deploy: Create release? or it will not be deployed by Octopus Deploy

Enter the url for Octopus Deploy and your Octopus API key.

If the project deployment steps have already been setup on Octopus Deploy and is ready to start deploying then, enter the project name and the environment you wish to deploy to.

Leave a Reply