Just mentioning few simple steps and command line by following which we can start working with Visual Studio Code.
Open terminal for specific created folder.
Create a new solution file, same name as folder
dotnet new sln
Create a new folder for project
mkdir app.webapi
Go to project folder
cd app.webapi
Create a new dot net core web api project:
Dotnet new webapi
Back to root folder:
Cd ..
Create a new folder for 2nd project
Mkdir app.web
Go to folder:
Cd app.web
Create csproj for other dotnet core web project:
Dotnet new web
Back to root folder:
Cd ..
Add webapi project to solution:
dotnet sln VsCodeMultiAppLaunch.sln add .\app.webapi\app.webapi.csproj
Add web project to solution:
dotnet sln VsCodeMultiAppLaunch.sln add .\app.web\app.web.csproj
Back to root folder:
Cd ..
Create new folder for web api data access project:
Mkdir app.webapi.dal
Go to newly created folder:
Cd app.webapi.dal
Create a new class library:
Dotnet new classlib
Back to root folder:
Cd ..
Add app.webapi.dal project to solution:
dotnet sln VsCodeMultiAppLaunch.sln add .\app.web\app.web.csproj
After execution of above command we can verify content under workstation.
Add app.webapi.dal refrence to app.webapi project.
dotnet add .\app.webapi\app.webapi.csproj reference .\app.webapi.dal\app.webapi.dal.csproj
Or else add in app.webapi\app.webapi.csproj manually:
<ItemGroup>
<ProjectReference Include="..\app.webapi.dal\app.webapi.dal.csproj" />
</ItemGroup>
Build all project:
Dotnet build
Debug
Press F5
It will create a new launch.json under .vscode
Now press 5 to Debug app.webapi project.
If you want to debug multiple project together, copy and paste configuration and modify accordingly.
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": ".NET Core Launch (web api)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/app.webapi/bin/Debug/netcoreapp3.0/app.webapi.dll",
"args": [],
"cwd": "${workspaceFolder}/app.webapi",
"stopAtEntry": false,
"serverReadyAction": {
"action": "openExternally",
},
"env": {
"ASPNETCORE_ENVIRONMENT": "Development",
},
},
{
"name": ".NET Core Launch (web)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/app.web/bin/Debug/netcoreapp3.0/app.web.dll",
"args": [],
"cwd": "${workspaceFolder}/app.web",
"stopAtEntry": false,
"serverReadyAction": {
"action": "openExternally",
},
"env": {
"ASPNETCORE_ENVIRONMENT": "Development",
},
"sourceFileMap": {
"/Views": "${workspaceFolder}/Views"
}
},
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach",
"processId": "${command:pickProcess}"
}
]
}
Now you will be getting
You can click one by one on Launch and will able to debug each project.