gpt4 book ai didi

powershell - Visual Studio Code 中的多线程调试

转载 作者:行者123 更新时间:2023-12-05 02:08:37 26 4
gpt4 key购买 nike

我一直在处理交给我的 Powershell 脚本。以前从未处理过 powershell 脚本,我有很多东西要学。到目前为止,我一直在使用 Visual Studio Code 来运行/调试它。它一直运行良好,但是,我在处理多个线程的特定区域遇到了问题。我无法在特定断点处暂停 Powershell 脚本。

经过过去几天的全面研究,线程似乎可以在 Visual Studio 中处理。我下载了 Visual Studio Community 2019 并尝试安装“Powershell Tools for Visual Studio”套件。根据包管理器的说法,它已经安装没有问题。但是,我无法创建 Powershell 项目(我应该能够创建),并且在 Visual Studio 2019 的扩展管理器中看不到它。为确保这不是我的错误,我尝试过安装几次,使用不同的方法。

我还查看了用于调试的 Windows 内置 Powershell ISE,但遇到了与 Visual Studio Code 相同的问题。这使我无法在我需要查看的特定位置进行正确调试。我在大部分脚本中都使用了 Write-Host 但是,因为这是交给我的脚本,所以我宁愿能够暂停并查看给定状态下的所有变量,而无需必须全部打印出来。

有什么方法可以轻松在 Visual Studio Code 中调试多线程应用程序吗?如果没有,除了添加 Write 之外还有哪些建议-HostWrite-Debug 或类似的 cmdlet。

最佳答案

您混淆了工具和用例,这是由于您误解了 PowerShell 和处理它的工具,如果您以前从未这样做过,那将是意料之中的。

如果您没有 PowerShell 经验,最好先上手。跳入一种您从未使用或理解的语言的工具是不明智的。跳转到 Youtube 并搜索 'Beginning PowerShell'并在进一步移动之前查看其中的一些内容。

这不是 PowerShell 代码问题,这是我们在此提供帮助的问题。

您的问题是“如何为 Powershell 开发配置 VSCode 和/或 Visual Studio?”,因此对于 StackOverflow 来说是题外话,对于 SuperUsers 或 StackExchange 来说更像是一个问题。

How do I ask a good question? - Help Center - Stack Overflow

既然你在这里并且我使用这个插件,让我提供一些启发。

  1. VSCode 有一个来自 Microsoft 的用于 PowerShell 开发的扩展,但这只是 Microsoft PowerShell 扩展。
  2. PowerShell Pro Tools for Visual Studio/VSCode 不是免费工具,也不是来自 Microsoft。您必须为此付费才能启用所有它的特点。您只需要一份 PowerShell Pro Tools 副本/许可证在 Visual Studio/VSCode 中使用。

PowerShell Pro Tools Suite https://ironmansoftware.com/powershell-pro-tools

PowerShell Pro Tools

PowerShell Pro Tools adds script packaging, a Windows Form Designer, code conversion and a Universal Dashboard previewer to VS Code.

PowerShell Pro Tools provides Visual Studio integration through the PowerShell Tools for Visual Studio. The Visual Studio integration provides the following features. Packaging as executables including command line utilities and services Windows Forms Designer WPF Designer Integration Code Conversion

您可以从产品作者的 Ironman 软件或 Youtube 上购买查看该工具的使用方法。只需搜索即可。

'powershell pro tools for VSCode'

'powershell pro tools for vscode projects'

'powershell pro tools for Visual Studio'

'powershell pro tools for visual studio projects'

关于powershell - Visual Studio Code 中的多线程调试,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60673575/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com