vscode-cpptools icon indicating copy to clipboard operation
vscode-cpptools copied to clipboard

Have trouble when Run VS Code outside the Developer Command Prompt

Open mind-dance opened this issue 8 months ago • 4 comments

I have set up tasks.json but still can't run VS Code outside the Developer Command Prompt. My tasks.json like this:

{
    "windows": {
        "options": {
          "shell": {
            "executable": "cmd.exe",
            "args": [
              "/C",
              // The path to VsDevCmd.bat depends on the version of Visual Studio you have installed.
              "\"C:/Program Files/Microsoft Visual Studio/2022/Community/Common7/Tools/VsDevCmd.bat\"",
              "&&"
            ]
          }
        }
      },
    "tasks": [
        {
            "type": "cppbuild",
            "label": "C/C++: cl.exe 生成活动文件",
            "command": "cl.exe",
            "args": [
                "/Zi",
                "/EHsc",
                "/nologo",
                "/Fe${fileDirname}\\${fileBasenameNoExtension}.exe",
                "${file}"
            ],
            "options": {
                "cwd": "${fileDirname}"
            },
            "problemMatcher": [
                "$msCompile"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "detail": "调试器生成的任务。"
        }
    ],
    "version": "2.0.0"
}

when I run code, it still prompt me that I need Developer Command Prompt

error

mind-dance avatar Jun 21 '24 15:06 mind-dance