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

时间:2010-11-19 09:47:08

标签: powershell

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

  

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

     

C:\ Windows \组件\ GAC_MSIL \ System.Management.Automation \ 1.0.0.0__31bf3856ad364e35 \ System.Management.Automation.dll   System.Runtime.Remoting   C:\ Windows \ Microsoft.NET \框架\ V2.0.50727 \对System.Runtime.Remoting.dll

1 个答案:

答案 0 :(得分:5)

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

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

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

using System.Management.Automation;
using System.Management.Automation.Runspaces;
相关问题