Cloud Native 8 min read

Building a Container‑Based CI/CD Pipeline with VSTS/TFS for ASP.NET Core

This article explains how to use Microsoft Visual Studio Team Services/Team Foundation Server together with Docker to create a full‑stack, container‑based CI/CD pipeline for ASP.NET Core applications, covering environment setup, build agents, Docker host connections, and release strategies for test and production.

DevOps
DevOps
DevOps
Building a Container‑Based CI/CD Pipeline with VSTS/TFS for ASP.NET Core

In previous d4d series articles we introduced using Docker to support ASP.NET Core development and packaging; this article now shows how to leverage Microsoft’s full‑lifecycle management platform VSTS/TFS to build a container‑based CI/CD pipeline for team development.

VSTS (the SaaS version on Azure) and TFS (the on‑premises edition) provide end‑to‑end management of the software development process, offering free access for teams of up to five developers and unlimited stakeholders.

Container‑Based CI/CD

Containers address environment consistency and simplify migration of the same application version across development, testing, pre‑production, and production environments, making them especially valuable for team‑based DevOps workflows.

The required toolchain is illustrated in the following diagrams:

The diagrams show a multi‑level technology stack where Docker abstracts the lower‑level environment, simplifying the release process.

Below are the steps to configure the container‑based CI/CD environment:

1. Create container hosts for development, testing, and production

Refer to the earlier articles “#1 前世今生 & 世界你好” and “#2 容器化主机” for detailed instructions.

2. Configure a TFS build agent on a Linux server

See the article “用VSTS/TFS搭建iOS持续集成环境” for guidance.

3. Connect container hosts to TFS

In TFS, navigate to Service → New Service Endpoint → Docker Host and provide the host URL and the PEM file from ~/.docker/machine/machines/{machine‑name} .

Repeat for test and production hosts, creating endpoints Dockerhost‑test and Dockerhost‑pro .

4. Connect Docker Hub account to TFS

In TFS, go to Service → New Service Endpoint → Docker Registry and enter your Docker Hub credentials; adjust the registry URL for private registries.

5. Define the CI build

Create a build definition and point the default agent queue to the Linux build agent. Add the following tasks in order: dotnet restore , dotnet build , dotnet publish , docker build , and docker push . The Docker build uses the variable $(Build.BuildNumber) as the image tag.

6. Create the CD release pipeline

Configure a release pipeline with separate stages for test and production, each performing: stop running container, remove container, and run container.

7. Configure promotion and approval policies

Set the production deployment to trigger only after a successful test deployment, and require approval from specific users before execution.

With these configurations, a complete container‑based CI/CD pipeline is established.

DockerCI/CDDevOpscontainerizationASP.NET CoreVSTS
DevOps
Written by

DevOps

Share premium content and events on trends, applications, and practices in development efficiency, AI and related technologies. The IDCF International DevOps Coach Federation trains end‑to‑end development‑efficiency talent, linking high‑performance organizations and individuals to achieve excellence.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.