如何将Visual Studio Developer Prompt添加为Visual Studio Code的终端Shell
在VS Code中配置Visual Studio Developer PowerShell终端
- 打开VS Code设置:直接按
Ctrl+,(Windows/Linux)或Cmd+,(Mac),也可以通过「文件」→「首选项」→「设置」打开。 - 搜索
terminal.integrated.profiles.windows,点击「编辑 in settings.json」进入配置文件。 - 在配置里添加Visual Studio Developer PowerShell的专属配置(替换原有Windows终端配置或直接追加):
"terminal.integrated.profiles.windows": { "PowerShell": { "source": "PowerShell", "icon": "terminal-powershell" }, "Command Prompt": { "path": [ "${env:windir}\\Sysnative\\cmd.exe", "${env:windir}\\System32\\cmd.exe" ], "args": [], "icon": "terminal-cmd" }, "Visual Studio Developer PowerShell": { "path": "powershell.exe", "args": [ "-NoExit", "-Command", "& 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\Community\\Common7\\Tools\\Launch-VsDevShell.ps1'" ], "icon": "terminal-powershell" } }, "terminal.integrated.defaultProfile.windows": "Visual Studio Developer PowerShell"
- 注意:把路径里的
2022\\Community改成你实际的VS版本(比如2019)和版本类型(比如Professional/Enterprise),确保路径指向正确的Launch-VsDevShell.ps1脚本。 - 保存settings.json,重启VS Code终端(或直接重启VS Code),之后打开的终端就是Visual Studio Developer PowerShell会话,会自动加载VS的开发环境变量。
内容的提问来源于stack exchange,提问作者Schwarzie2478
相关产品推荐
相关产品推荐

