Description
Trying to debug an application using different environment variables for the use use of appSettings.env.json i.e.:
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
does not pick up a secondary profile. So I can have a Development env and a UAT env but it only picks up the first one when I hit debug. Same thing happens on Compounds:
launch.json sample:
{
"version": "0.2.0",
"configurations": [
{
"name": "MyAppDev",
"type": "dotnet",
"request": "launch",
"projectPath": "${workspaceFolder}/MyApp/MyApp.csproj",
"launchConfigurationId": "TargetFramework=;MyAppDev"
},
{
"name": "MyAppUAT",
"type": "dotnet",
"request": "launch",
"projectPath": "${workspaceFolder}/MyApp/MyApp.csproj",
"launchConfigurationId": "TargetFramework=;MyAppUAT"
},
]
}
LaunchSettings.Json sample:
{
"$schema": "http://json.schemastore.org/launchsettings.json",
"profiles": {
"MyAppDev": {
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "clients",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development",
},
"applicationUrl": "https://localhost:44334"
}
"MyAppUAT": {
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "clients",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "UAT",
},
"applicationUrl": "https://localhost:44334"
}
}
}
If the CSharp: Report an issue
command doesn't appear, make sure that you have C# extension version 1.17.0 or newer installed.
Environment data
VS Code version: 1.93.1 (Universal)
C# Extension version: current latest and Pre-release versions
Steps to reproduce
- go to Debug
- select profile 1, run, it loads c# app on development.
- select profile 2, run, it loads c# app still on development instead of UAT
Expected behavior
the UI will pick the correct profile to launch
Additional context
This was working on a few versions ago, but I didnt had to use vscode on this project for a while until recently that realized it was not picking up my other environments.