Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
patoJamriska opened this issue Sep 20, 2024 · 1 comment
Assignees
Labels

Comments

@patoJamriska
Copy link

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.

@patoJamriska patoJamriska changed the title launch.jsopn does not pickup a seondary launchConfigurationId from Properties/launchSettings.JSON launch.json does not pickup a seondary launchConfigurationId from Properties/launchSettings.JSON Sep 20, 2024
@WardenGnaw
Copy link
Contributor

@patoJamriska Do you have C# Dev Kit installed?

launchConfigurationId was not intended to really be saved in a launch.json but was supposed to be used by the dynamic configuration provider which is used internally by the resolver in C# Dev Kit.

The dotnet debug type only supports using projectPath if you are using launch.json

@WardenGnaw WardenGnaw self-assigned this Sep 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants