【问题标题】:Debug Powershell cmdlet (written in c#) in VS Code在 VS Code 中调试 Powershell cmdlet(用 c# 编写)
【发布时间】:2020-06-27 01:42:38
【问题描述】:

另一个问题解决了如何在 Visual Studio 2015-19 中调试用 C# 编写的 Powershell cmdlet: Debugging / unloading PowerShell Cmdlet

我可以以某种方式调用这样的脚本:

function Start-DebugPowerShell
{
    PowerShell -NoProfile -NoExit -Command {
        function prompt {
            $newPrompt = "$pwd.Path [DEBUG]"
            Write-Host -NoNewline -ForegroundColor Yellow $newPrompt
            return '> '
        }
    }
}
Set-Alias -Name sdp -Value Start-DebugPowerShell

这使得创建临时 PS 实例变得容易,您可以 exit 卸载该实例。

或者我可以像这样在 VS 项目中设置调试选项,效果很好:

我想做同样的事情,但使用 Visual Studio Code。我知道如何使用附加进行调试(例如,使用这些 launch.json 设置:

    {
        "name": ".NET Core Attach",
        "type": "coreclr",
        "request": "attach",
        "processId": "${command:pickProcess}",
        "justMyCode": false
    }

我不知道如何制作一个首先启动 pwshlaunch.json。项目类型是csharp,因此launch.json 中唯一可用的types 是coreclrclr

【问题讨论】:

    标签: c# powershell visual-studio-code vscode-debugger cmdlets


    【解决方案1】:
    猜你喜欢
    • 1970-01-01
    • 2020-08-25
    • 2013-06-08
    • 2019-12-29
    • 1970-01-01
    • 1970-01-01
    • 2018-12-14
    • 1970-01-01
    • 2016-06-25
    相关资源
    最近更新 更多