Create a CI/CD pipeline for containerized ASP.NET Core projects

Ahmed Metwally

We are looking to improve your experience on the Visual Studio Blog. It would be very helpful if you could share your feedback via this short survey that should take less than 2 minutes. Thanks!

At //BUILD 2017, we shipped an update to the Continuous Delivery Tools for Visual Studio with support for configuring a Continuous Integration and Continuous Delivery pipeline for ASP.NET Core projects with container support to an existing Azure App Service on Linux directly from Visual Studio 2017. With the latest update to the extension we introduced the ability to create a new Azure App Service On Linux while configuring continuous delivery.

To configure continuous delivery to App Service on Linux, create or open an existing solution with an ASP.NET Core project. Add Docker support to the project and ensure that the solution is under version control on VSTS or GitHub. Right click on the solution in Solution Explorer and select Configure Continuous Delivery.

Then, select App Service (Linux) as the Target Host type and use the default newly created app service or select an existing Azure App Service to act as a target for continuous delivery.

You can click the “Edit…” link beside the App Service field to edit the new App Service configuration. You can change the Location, Resource Group, App Service Plan and Service Plan size using the “Edit App Service” dialog.

If you are not using an existing App Service as your target host, the registry settings for that App Service should match your selected container registry as the VSTS release definition only updates the image name and tag, not the full container registry settings. With the latest update to the extension, you now get an error that the container registry settings must change for continuous delivery to work successfully.

Clicking “Allow App Service settings change to a private registry”, will enable the Configure Continuous Delivery Dialog to update the selected App Service settings when you click OK to configure continuous delivery

If your solution contains an ASP.NET Core 2.0 project you will need to make a manual change to the Docker-compose.ci.build.yml as per the highlighted section below to ensure that it points to the right ASP.NET Core 2.0 container image (microsoft/aspnetcore-build:1.0-2.0) for the solution to build successfully on VSTS. With projects generated using Visual Studio 2017 version 15.4 and up, this manual change will not be necessary.

version: '3'
services:
  ci-build:
    image: microsoft/aspnetcore-build:1.0-2.0
    volumes:
      - .:/src
    working_dir: /src
    command: /bin/bash -c "dotnet restore ./ASPNETCore20Test.sln && dotnet publish ./ASPNETCore20Test.sln -c Release -o ./obj/Docker/publish"

Please keep the feedback coming!

Thank you to everyone who has reached out and shared feedback and ideas so far. We’re always looking for feedback on where to take this Microsoft DevLabs extension next. There’s a Slack channel and a team alias vsdevops@microsoft.com where you can reach out to the team and others in the community sharing ideas on this topic.

0 comments

Discussion is closed.

Feedback usabilla icon