Here is the full example.
Let's assume this is your project's structure:
\.vscode
launch.json
\src
\YourApp
\Properties
launchSettings.json
appsettings.json
YourApp.csproj
Part of launchSettings.json
content with profile:
{
"profiles": {
"Sample": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "https://localhost:7152;http://localhost:5105",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}
The minimum working launch.json
file content:
{
"version": "0.2.0",
"configurations": [
{
"name": "YourApp Sample",
"type": "coreclr",
"request": "launch",
"program": "${workspaceFolder}/src/YourApp/bin/Debug/net8.0/YourApp.dll",
"cwd": "${workspaceFolder}/src/YourApp",
"launchSettingsFilePath": "${workspaceFolder}/src/YourApp/Properties/launchSettings.json",
"launchSettingsProfile": "Sample"
}
]
}
It's important to set cwd
in case if your project folder is not the same as ${workspaceFolder}
. More details here.