System.Management.Automation和System.Runtime.Remoting程序集

vic*_*cky 4 powershell

我在我的C#应用​​程序中添加了Assemblies(System.Management.Automation和System.Runtime.Remoting)的引用,并在我的项目中使用了powershell接口.但在代码的补充过程中,我发现了一个错误

"命名空间'System.Management.Automation'中不存在类型或命名空间名称'Remoting'"无法找到类型或命名空间名称'PowerShell'

C:\ WINDOWS\assembly\GAC_MSIL\System.Management.Automation\1.0.0.0__31bf3856ad364e35\System.Management.Automation.dll System.Runtime.Remoting C:\ WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Runtime .Remoting.dll

Kei*_*ill 5

对于编译,您应该在此位置引用System.Management.Automation程序集:

C:\Program Files (x86)\Reference Assemblies\Microsoft\WindowsPowerShell\v1.0

如果您正在寻找PowerShell远程处理,则需要使用命名空间System.Management.Automation.Remoting.对于PowerShell类型,您可能需要在C#源代码文件中使用以下using语句:

using System.Management.Automation;
using System.Management.Automation.Runspaces;
Run Code Online (Sandbox Code Playgroud)