【问题标题】:How to Change Visual Studio Code 'Powershell Integrated Console'?如何更改 Visual Studio 代码“Powershell 集成控制台”?
【发布时间】:2020-04-29 15:18:10
【问题描述】:

有没有人知道如何安装/更新 PS 7 以供 VS Code Powershell 集成控制台使用。我可以在常规的 powershell 终端上获得 PS 7,但是 Powershell 集成控制台仍然是 PSVersion 5.1。我似乎无法弄清楚如何改变这一点。任何帮助将不胜感激。

我的 settings.json 如下:

【问题讨论】:

  • 在 settings.json 中有这个允许我将 pwsh 作为集成控制台运行 "terminal.integrated.shell.windows": "C:\\Program Files\\PowerShell\\7\\pwsh.exe"

标签: powershell visual-studio-code


【解决方案1】:

我正在使用此代码,它对我有用。

"powershell.powerShellAdditionalExePaths": [
{
    "exePath": "C:\\Program Files\\PowerShell\\7\\pwsh.exe",
    "versionName": "Downloaded PowerShell"
}
],
"powershell.powerShellDefaultVersion": "Downloaded PowerShell",

"terminal.integrated.shell.windows": "C:\\Program Files\\PowerShell\\7\\pwsh.exe",

【讨论】:

    【解决方案2】:

    Powershell 7.x(又名 pwsh.exe,以前称为 Powershell Core)现在是 Visual Studio 2022 中的默认 shell。我认为它应该是 VSCode 中的默认 Powershell 版本(如果扩展检测到 Powershell 7+ 存在)。如果用户安装了它,我认为它现在通常应该是默认设置。

    {
        "powershell.powerShellAdditionalExePaths": [{
            "exePath": "C:\\Program Files\\PowerShell\\7\\pwsh.exe",
            "versionName": "PowerShell 7.x customized"
        }],
        "powershell.powerShellDefaultVersion": "PowerShell 7.x customized",
    }
    

    【讨论】:

    • 这是唯一对我有用的解决方案。谢谢
    • 由于某种原因,我安装的 vs2022 Powershell 7.x 不是默认的。我很乐意将其设为默认值。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-02-11
    • 1970-01-01
    • 1970-01-01
    • 2014-06-06
    • 2019-08-17
    • 2022-09-23
    • 2023-02-02
    相关资源
    最近更新 更多