开发者

Cannot load Windows PowerShell snap-in Microsoft.PowerShell.Host

I'm attempting to invoke Windows Powershell cmdlets via Visual Studio .NET. However, I'm getting the exception shown below when I try to call a function.The Microsoft.PowerShell.ConsoleHost.dll wasn't initially in that path so I copied it over from another location. Is this the right way of installing a snap-in? It still spits out that exception and I'm not sure why. Any nudges in the right direction would be very helpful. Thanks.

System.Management.Automation.Runspaces.PSSnapInException: Cannot load Windows PowerShell snap-in Microsoft.PowerShell.Host because of the following error: Could not load file or assembly 'file:///C:\Windows\System32\WindowsPowerShell\v1.0\Microsoft.PowerShell.ConsoleHost.dll' or one of its dependencies. The system cannot find the file specified. System.Management.Automation.Runspaces.PSSnapInException: at Syst开发者_JAVA百科em.Management.Automation.Runspaces.RunspaceConfigForSingleShell.LoadMshSnapinAssembly(PSSnapInInfo mshsnapinInfo) at System.Management.Automation.Runspaces.RunspaceConfigForSingleShell.LoadPSSnapIn(PSSnapInInfo mshsnapinInfo) at System.Management.Automation.Runspaces.RunspaceConfigForSingleShell.LoadPSSnapIns(Collection`1 mshsnapinInfos, PSConsoleLoadException& warning) at System.Management.Automation.Runspaces.RunspaceConfigForSingleShell.CreateDefaultConfiguration() at System.Management.Automation.Runspaces.RunspaceConfiguration.Create()


Try to use fuslogvw tool provided by MS. It helps in such problems, when some assemblies can not be loaded.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜