How to Run two .net core apps with debugging On using Visual Studio Code ?

When developing a web application we separate our application with *.web being initial server-side application and  *.api application which will help us fetch/update data for client-side operations and avoid page reloads.


Photo by Vincent van Zalinge on Unsplash

Here is .NET Core application I was working on which had a similar kind of ask, and I wanted to use VSCode to debug my application.

This is how we do it, first, we need to create a solution so that we keep both the API and Web project in one place

dotnet new sln -n appname
dotnet sln add src/appname/appname.web.csproj
dotnet sln add src/appname/apname.api.csproj

Open "launch.json" and Click on add configuration and add then select

.NET Core Launch (web) 

No go ahead and rename to web or web-api, also add a development URL with a different than web configs the "env" property

"env": {
"ASPNETCORE_ENVIRONMENT": "Development",
"ASPNETCORE_URLS": "https://localhost:5001"
}

Done now just run each of the configs with debug mode and happy debugging!

For reference adding the complete launch.json

Comments

Popular posts from this blog

Launch .Net Core with VSCode for starters

Chrome in a nut shell

Developing SMS Services in C#