简体   繁体   English

从C#调试powershell脚本文件(PS1)

[英]debugging powershell script file (PS1) from C#

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()". 我们已经创建了PS1文件。我们可以使用Runspace,Pipeline等从C#调用PS1文件中的函数。我只能调试“pipeline.Invoke()”。

But now my question is whether it is possible to debug the PS1 file from pipile.Invoke()? 但现在我的问题是是否可以从pipile.Invoke()调试PS1文件? I mean Pressing F11 on "pipeline.Invoke()" can take me into the PS1 files? 我的意思是在“pipeline.Invoke()”上按F11可以带我进入PS1文件? I basically want to debug the powershell script files from C#. 我基本上想从C#调试powershell脚本文件。

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. 您必须直接与运行空间的调试器事件进行交互,并基本上构建自己的引擎,将其集成到Visual Studio中。 This would be quite a time consuming, which is why it hasn't been done. 这将非常耗时,这就是为什么没有这样做的原因。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM