Is there a way to add the Developer Powershell for VS 2019 as an integrated terminal in VSCode?

冷暖自知 提交于 2021-02-16 15:09:51

问题


I'm working on a project that requires me to compile C++ code using MSVC, but I am working mostly with VSCode. As such, I was wondering if there is a way for me to add the Developer Powershell as an integrated terminal, so that I can compile without needing a secondary terminal open. I thought of just opening VSCode from the Developer PS itself, but since this is mostly a temporary project it seemed like a lot of repetitive work. I tried using the Shell launcher extension for VSCode but it didn't work. Is there anything I can do?


回答1:


To make Visual Studio Code's integrated terminal act like the Developer PowerShell for VS 2019 console that comes with Visual Studio 2019, add the following to your Visual Studio Code settings.json file (> Preferences: Open Settings (JSON)):

"terminal.integrated.shell.windows": "C:/Windows/SysWOW64/WindowsPowerShell/v1.0/powershell.exe"

and

"terminal.integrated.shellArgs.windows": "-noe -c Import-Module 'C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/Common7/Tools/Microsoft.VisualStudio.DevShell.dll'; Enter-VsDevShell ed9e071d"

Note that a 32-bit version of PowerShell is started, followed by import of a module and a call to a function from that module.

I've taken (and adapted) the commands - whose details may differ depending on the Visual Studio version - from the Properties dialog of the following shortcut file (*.lnk):

C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Visual Studio 2019\Visual Studio Tools\Developer PowerShell for VS 2019.lnk


来源:https://stackoverflow.com/questions/61625920/is-there-a-way-to-add-the-developer-powershell-for-vs-2019-as-an-integrated-term

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!