我有麻烦了的PowerShell
类来解决。我在this问题。
I'm having trouble getting the PowerShell
class to resolve. I'm following along with the example in this question.
我已经加入到 System.Management.Automation
引用从 C:\ Program Files文件\参考大会\微软\ WindowsPowerShell \ V1.0 \ System.Management.Automation.dll
我有使用System.Management.Automation;
包括在我的班上名列前茅
I have using System.Management.Automation;
included at the top of my class.
然而,当我尝试创建的PowerShell的一个实例:的PowerShell PS = PowerShell.Create()
,的PowerShell
将无法解决。
However, when I try to create an instance of powershell: PowerShell ps = PowerShell.Create()
, PowerShell
won't resolve.
使用 CTRL + 可自动添加完全限定的命名空间(或using语句)只是表明 Microsoft.Powershell
在的PowerShell
。
Using ctrl+. to auto-add the fully-qualified namespace (or using statement) just suggests Microsoft.Powershell
in place of PowerShell
.
我很困惑,为什么发生这种情况,因为即使列入上的PowerShell类 MSDN文档有pretty的多正是我。
I'm very confused why this is happening as even the example included in the MSDN documentation on the PowerShell class has pretty much exactly what I have.
我在.NET 3.5,Visual Studio 2010中,和Windows Server 2008 R2
I am in .NET 3.5, Visual Studio 2010, and Windows Server 2008 R2
PowerShell的类是新来的PowerShell 2.0。确保你引用2.0版本SMA.dll的。你有PowerShell的2.0安装?
The PowerShell class is new to PowerShell 2.0. Make sure you're referencing the 2.0 version of SMA.dll. Do you have PowerShell 2.0 installed?