Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NuGet Package Manager Console unable to load PowerShell

After performing an in place upgrade from Windows 7 Pro to 8 Pro I have been unable to get NuGet's package manager console to run in Visual Studio 2012 Pro. The error I receive is:

The following error occurred while loading the extended type data file: Microsoft.PowerShell.Core, C:\WINDOWS\SysWOW64\WindowsPowerShell\v1.0\types.ps1xml(2977) : Error in type "System.Security.AccessControl.ObjectSecurity": Exception: The getter method should be public, non void, static, and have one parameter of type PSObject.
The following error occurred while loading the extended type data file: Microsoft.PowerShell.Core, C:\WINDOWS\SysWOW64\WindowsPowerShell\v1.0\types.ps1xml(2984) : Error in type "System.Security.AccessControl.ObjectSecurity": Exception: The getter method should be public, non void, static, and have one parameter of type PSObject.
The following error occurred while loading the extended type data file: Microsoft.PowerShell.Core, C:\WINDOWS\SysWOW64\WindowsPowerShell\v1.0\types.ps1xml(2991) : Error in type "System.Security.AccessControl.ObjectSecurity": Exception: The getter method should be public, non void, static, and have one parameter of type PSObject.
The following error occurred while loading the extended type data file: Microsoft.PowerShell.Core, C:\WINDOWS\SysWOW64\WindowsPowerShell\v1.0\types.ps1xml(2998) : Error in type "System.Security.AccessControl.ObjectSecurity": Exception: The getter method should be public, non void, static, and have one parameter of type PSObject.
The following error occurred while loading the extended type data file: Microsoft.PowerShell.Core, C:\WINDOWS\SysWOW64\WindowsPowerShell\v1.0\types.ps1xml(3005) : Error in type "System.Security.AccessControl.ObjectSecurity": Exception: The getter method should be public, non void, static, and have one parameter of type PSObject.
The term 'Get-ExecutionPolicy' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

I have searched for the last several days for ways to fix this but have been coming up completely empty. I have tried all of these with no avail:

  • Disabling all Visual Studio add ons
  • Resetting all settings
  • Reinstalling Visual Studio
  • Repairing Visual Studio
  • Starting PowerShell before Visual Studio (Does this just mean launch PowerShell and then launch Visual Studio?)
  • Running both PowerShell and Visual Studio as admin
  • Running Visual Studio in safe mode
  • Setting Power Shell ExecutionProperty to unrestricted

Visual Studio has been exhibiting other odd behaviors such as consistently crashing while trying to add a Click event to XAML on a specific page as well, and because of this my gut says it's not really Power Shell or NuGet but an issue with my OS/Visual Studio.

Unless someone has a solution I think I'm down to just doing a clean install of Windows 8 and hoping that that fixes it.

like image 896
siva.k Avatar asked Oct 05 '22 11:10

siva.k


1 Answers

I found this issue which is very similar to yours:

Embedding Powershell v2.0 in .NET app on Windows 8 RTM

Can you try the solution on that question to see if it fixes it?

like image 169
superkinhluan Avatar answered Oct 10 '22 02:10

superkinhluan