【发布时间】:2017-09-27 13:17:07
【问题描述】:
我正在尝试使用 c# 中的(远程)powershell。
我用:
using System.Management.Automation;
using System.Management.Automation.Runspace;
但是当我尝试构建我的应用程序时,我遇到了错误 CS0234(名称在命名空间中不存在)。我添加了 System.Management 的引用。
哪种编译方式?
Ps:我找到了一个帖子,他们说要添加 C:\Program Files (x86)\Reference Assemblies\Microsoft\WindowsPowerShell\v1.0 作为参考,但我没有这条路径...
PPs : Powershell 已完全安装在我的计算机上。
PPPs : 使用 win10 64 位
【问题讨论】:
-
你搜索过那个目录吗?又名 windowspowershell\1.0
-
添加引用并浏览...转到该路径(可以是 3.0 或 1.0)并选择 System.Management.Automation.dll
-
顺便说一句,对于 64 位 win7,该路径似乎是正确的 ...
标签: c# powershell .net-assembly