【发布时间】: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 卸载该实例。
我想做同样的事情,但使用 Visual Studio Code。我知道如何使用附加进行调试(例如,使用这些 launch.json 设置:
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach",
"processId": "${command:pickProcess}",
"justMyCode": false
}
我不知道如何制作一个首先启动 pwsh 的 launch.json。项目类型是csharp,因此launch.json 中唯一可用的types 是coreclr 和clr。
【问题讨论】:
标签: c# powershell visual-studio-code vscode-debugger cmdlets