Windows PowerShell snap-in Microsoft.PowerShell.Host cannot be loaded
I am trying to call Windows Powershell cmdlets through Visual Studio .NET. However, I am getting the below exception when I try to call the function. Microsoft.PowerShell.ConsoleHost.dll was not originally in this path, so I copied it from somewhere else. Is this the correct way to install a snap? It still spits out this exception and I don't know why. Any nudges in the right direction would be very helpful. Thanks.
System.Management.Automation.Runspaces.PSSnapInException: Unable to load Windows PowerShell snap-in Microsoft.PowerShell.Host due to 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: in System.Management.Automation.Runspaces.RunspaceConfigForSingleShell.LoadMshSnapinAssembly (PSSnapInInfo mshsnapinInfo) in System.Management.Automation.Runspaces.RunspaceConfigForSingleShell.LoadPSSnapIn (PSSnapInInfo mshsnapinInfo) in System.Management.Automation.Runspaces .RunspaceConfigForSingleShell.LoadPSSnapIns (Collection`1 mshsnapinInfos, PSConsoleLoadException & warning) in System.Management.Automation.Runspaces.RunspaceConfigForSingleShell.CreateDefaultConfiguration.Autspace.figuration
a source to share