2010-11-19 51 views
3

我在C#應用程序中添加了Assemblies(System.Management.Automation和System.Runtime.Remoting)的引用,並在我的項目中使用了powershell接口。 但代碼的compliation期間,我歌廳一個錯誤說System.Management.Automation和System.Runtime.Remoting彙編

「的類型或命名空間名稱‘遠程處理’ 命名空間中不存在 ‘System.Management.Automation’」的 類型或命名空間名稱 'PowerShell的' 找不到

C:\ WINDOWS \裝配\ 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

+0

我認爲我們需要使用你正在使用的是造成錯誤陳述或全類的名字就知道.. 。我無法確定它爲什麼在談論「類型或命名空間名稱」PowerShell「」 – Jaykul 2010-11-19 15:10:58

回答

5

編譯,你應該在這個位置被引用System.Management.Automation組件:

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

如果您正在尋找PowerShell遠程處理,您需要使用命名空間System.Management。 Automation.Remoting。對於PowerShell的類型,你可能需要using語句在C#源代碼文件如下:

using System.Management.Automation; 
using System.Management.Automation.Runspaces;