Skip to content

launch.json does not pickup a seondary launchConfigurationId from Properties/launchSettings.JSON #7584

Open
@patoJamriska

Description

@patoJamriska

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

  1. go to Debug
  2. select profile 1, run, it loads c# app on development.
  3. 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.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions