从 C# 调试 powershell 脚本文件 (PS1) [英] debugging powershell script file (PS1) from C#
问题描述
我们已经创建了 PS1 文件.我们可以使用 Runspace、Pipeline 等从 C# 调用 PS1 文件中的函数.我只能调试到pipeline.Invoke()".
We have created PS1 files.We are able to call the function in PS1 file from C# using Runspace,Pipeline etc.I am able to debug only upto "pipeline.Invoke()".
但现在我的问题是是否可以从 pipile.Invoke() 调试 PS1 文件?我的意思是在pipeline.Invoke()"上按 F11 可以带我进入 PS1 文件?我基本上想从 C# 调试 powershell 脚本文件.
But now my question is whether it is possible to debug the PS1 file from pipile.Invoke()? I mean Pressing F11 on "pipeline.Invoke()" can take me into the PS1 files? I basically want to debug the powershell script files from C#.
推荐答案
有可能,但不是特别可行.您必须直接与运行空间的调试器事件进行交互,并且基本上构建您自己的引擎,将其集成到 Visual Studio 中.这将是相当耗时的,这就是为什么还没有完成的原因.
It's possible, but not particularly feasible. You have to directly interact with the runspace's debugger events, and essentially build your own engine integrating that into Visual Studio. This would be quite a time consuming, which is why it hasn't been done.
这篇关于从 C# 调试 powershell 脚本文件 (PS1)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!