Continuous Delivery – ASP.Net Core web applications using Visual Studio Team Services and Octopus Deploy Hosted in Azure

This article should help you get started with Continuous delivery pipeline using Visual Studio Team Services and Octopus Deploy. This blog post came out after playing with ASP.Net Core applications. To get it working it was bit fiddly but towards the end I got it working. Building applications and Deploying application in azure is getting easier and smooth every day by day. Below Steps should not take no more than 30 minutes to setup a Continuous delivery pipeline. One thing I have to say, Octopus Deploy and Visual Studio Team Services team have really nailed the smooth integration of both products without any pain.

Pre-requisites

  1. Visual Studio Team Services account (https://www.visualstudio.com/)
  2. Enable Package Management (https://goo.gl/dB7diC)
  3. Octopus Deploy (http://bit.ly/2e212w7)
  4. Octopus Generic Endpoint in VSTS.
  5. Microsoft Azure Subscription and Concepts of Azure websites
  6. Visual Studio 2015 Update 3 (https://www.visualstudio.com/vs/)
  7. .Net Core 1.0.1 VS 2015 Tooling Preview 2 (https://go.microsoft.com/fwlink/?LinkID=827546)

    Note : If you have any issues in setting up, Its worth checking this location https://github.com/aspnet/Tooling/blob/master/known-issues.md

Once you have all the above pre-requisites sorted out. Let’s Start creating the Projects

Connect Visual Studio to the Visual Studio Team Services

Refer the screenshot below

Select the Project you wanted to user

Creating a new ASP.Net Core Application

File -> New -> Project

Once , the Project is created you can compile to make sure everything is working. If you have any issues make sure all the pre-requisites have been actioned.

Adding nuspec files to package the application

Make sure all the directories and sub directories are all packaged into the nuget package.

Now, you are ready to check in all the changes. Before you check-in make sure you can run the application from local machine.

Creating build Definition

Click on New and Select the Empty template as shown below

Select the project and tick the Continuous Integration project (Based on the branching strategy you can set the default branch to build)

Add a PowerShell script

Added DotNet Restore and publish as the first build steps

Once the dotnet core is publish we are going to nuget package and publish

Nuget Publisher

Changed the build number format in General tab as shown below

Install and Configure Octopus Deploy Extensions/Build Steps

https://marketplace.visualstudio.com/items?itemName=octopusdeploy.octopus-deploy-build-release-tasks&targetId=75b32f46-1199-475b-8c66-3f42e5735423

Create an Octopus Generic Endpoint

Now, Add a build Step to Create and deploy a release in Octopus from Visual Studio Team Services.

Configure the Create release step

Configure Deploy release

Configure Octopus Deploy Process Step

Once you check in you can see the code is being built and deployed as shown below

Now, you can see the page is being hosted in azure web app.

Lets make a small change to the website and deploy. As shown below

Now, it should automatically build, create a release and deploy. Also, the changes we have made above is visible.

The bonus and the level of integration you get with Visual Studio Team Services and Octopus deploy keeps on improving with enriched features. Refer the below screenshot for example

Hope you enjoyed the article. Please let me know your feedback… I’m happy to discuss.

Thanks for reading!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.