Debug ASP.NET Core on Docker with Visual Studio Code

Last Thursday I started reading the Free eBook: “Containerized Docker Application Lifecycle with Microsoft Tools and Platform” by Cesar de la Torre. The book is really easy to read and really gives the reader a glimpse on the way to approach the overall application lifecycle when using containers and Microsoft Technologies. One of the interesting things he mentions is the ability to debug your source code inside a container using Visual Studio or Visual Studio Code, so I decided to try it out and Debug ASP.NET Core on Docker with Visual Studio Code

First be aware of the following prerequisites:

Prerequisites Command
.NET Core 1.1 SDK for Windows Download and install: .NET Core 1.1 SDK for Windows
Docker for Windows Download and install: Docker for Windows (stable)
Visual Studio Code and C# Plugin Download and install from here: Code
Node.js Download and install from here: Node.js v6.9.2
Yeoman From a Command Prompt run the following: npm install -g yo
Generator-docker Run the following command: npm install -g generator-docker
Bower Run the following command: npm install -g bower
Gulp Run the following command: npm install -g gulp

Now let’s create an ASP .NET Core application and debug it inside Docker:

1. Create an ASP .NET Core application
2. Change your application port in Program.cs
3. Create the artifacts needed to Debug on Docker
4. Change dockerTask.ps1
5. Change the docker files
5. Debug your application

You can get a copy of the code here: https://github.com/cmendible/dotnetcore.samples/tree/master/debug.on.docker

Hope it helps!

5 thoughts on “Debug ASP.NET Core on Docker with Visual Studio Code

  1. Hi,Great work!!!! an observation, on the Prerequisites yeoman installation is twice, i thing that the second command must be npm install -g generator-docker
    Bye.

Leave a Reply

Your email address will not be published. Required fields are marked *