Skip to content

Key "cwd" is not allowed in launch.json when type is "dotnet", but documentation suggests it should be #252234

Closed as not planned
@mcclure

Description

@mcclure

Type: Bug

We have a launch.json. It looks like:

{
    // 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": "ProjectNameDebug (macOS)",
            "type": "dotnet",
            "request": "launch",
            "projectPath": "${workspaceFolder}/ProjectName/ProjectNameCs/ProjectName.csproj",
            // "cwd" : "${workspaceFolder}"
        },
}

It works, however, we are getting a confusing behavior where at runtime CWD is different depending on whether we press the run button or manually run dotnet run. To normalize this, we want to set the cwd of our launch.json target manually.

Several blog posts and StackOverflow answers, as well as, to my reading, this documentation page suggest that I should be able to put in a "cwd" key. However, when I enter this key (for example by removing the comment above) the "cwd" is underlined and it says "property cwd is not allowed". We see this warning both running VSCode on Windows and on Mac. If we ignore the warning and run anyway, it appears the "cwd" is being ignored.

If we change "type" to "coreclr", suddenly it lets us do "cwd" (the warning goes away). However if we do this other things break, and various documentation (including the debugger-settings page I link above) seem to suggest we want "type": "dotnet".

My "expected behavior" is that either it should work, or the debugger-settings documentation page on code.visualstudio.com— which already explains a number of exceptions to rules— should specify somewhere where the "cwd" key is or is not allowed (although not allowing you to set CWD would definitely be bizarre for an IDE).

VS Code version: Code 1.98.2 (ddc367e, 2025-03-12T13:32:45.399Z)
OS version: Windows_NT x64 10.0.19045
Modes:

System Info
Item Value
CPUs Intel(R) Core(TM) i5-6600 CPU @ 3.30GHz (4 x 3312)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off
Load (avg) undefined
Memory (System) 15.95GB (0.79GB free)
Process Argv --crash-reporter-id 016aba99-1948-45b1-92d2-e03054b45afc
Screen Reader no
VM 0%
Extensions (8)
Extension Author (truncated) Version
shaderlabvscodefree aml 1.3.6
csdevkit ms- 1.20.35
csharp ms- 2.80.16
vscode-dotnet-runtime ms- 2.3.2
cpptools ms- 1.25.3
vsliveshare ms- 1.0.5948
veriloghdl msh 1.16.0
vstuc vis 1.1.2

(1 theme extensions excluded)

A/B Experiments
vsliv368cf:30146710
vspor879:30202332
vspor708:30202333
vspor363:30204092
vswsl492:30256859
vscod805cf:30301675
binariesv615:30325510
c4g48928:30535728
azure-dev_surveyone:30548225
962ge761:30959799
h48ei257:31000450
pythontbext0:30879054
cppperfnew:31000557
dwnewjupytercf:31046870
pythonrstrctxt:31112756
nativeloc2:31192216
5fd0e150:31155592
dwcopilot:31170013
6074i472:31201624
dwoutputs:31242946
customenabled:31248079
hdaa2157:31222309
copilot_t_ci:31333650
e5gg6876:31277805
pythoneinst12:31285622
bgtreat:31268568
4gafe986:31271826
c7cif404:31314491
996jf627:31283433
pythonrdcb7:31303018
usemplatestapi:31297334
0aa6g176:31307128
7bj51361:31289155
aj953862:31281341
generatesymbolt:31295002
convertfstringf:31295003
pylancequickfixf:31329273
convertlamdaf:31329270
c4b42873:31332228
d7aab740:31332224
usemarketplace:31333563
id45c886:31333049

Metadata

Metadata

Assignees

Labels

*caused-by-extensionIssue identified to be caused by an extension

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions