c# - 在 VS Code 中调试 Powershell cmdlet(用 c# 编写)
问题描述
另一个问题解决了如何在 Visual Studio 2015-19 中调试用 C# 编写的 Powershell cmdlet: 调试/卸载 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
这使得创建可以exit
卸载的临时 PS 实例变得容易。
我想做同样的事情,但使用 Visual Studio Code。我知道如何使用附加进行调试(例如,使用以下launch.json
设置:
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach",
"processId": "${command:pickProcess}",
"justMyCode": false
}
我不知道如何制作launch.json
第一次发布pwsh
。项目类型是csharp
,因此唯一type
可用的 slaunch.json
是coreclr
和clr
。
解决方案
推荐阅读
- amazon-web-services - AWS CloudWatch 代理使用 IMDSv2 监控内存
- react-native - React-native - 将应用程序部署到 xcode 时出错 - 找不到选项“-LL/Users/...”的目录
- xamarin.ios - UIScrollView 停止得太快了
- c++ - 试图将 SFML 精灵加载到数组中,然后访问每个精灵的属性?
- oop - 覆盖类层次结构的一个属性
- ansible - 如何将元信息添加到 ansible playbook 任务
- oracle - 从oracle plsql中的ulid中提取时间戳
- django - Django表单没有出现
- html - 带有边框半径的自定义滚动条
- javascript - Protractor JavaScript 获取文本标签 h1