NuGet包管理器控制台无法加载PowerShell

时间:2013-01-04 16:25:32

标签: visual-studio powershell nuget

在执行从Windows 7 Pro到8 Pro的就地升级后,我无法让NuGet的程序包管理器控制台在Visual Studio 2012 Pro中运行。我收到的错误是:

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.

我已经搜索了最近几天的方法来解决这个问题但是已经完全没空了。我已经尝试了所有这些但无济于事:

  • 禁用所有Visual Studio添加
  • 重置所有设置
  • 重新安装Visual Studio
  • 修复Visual Studio
  • 在Visual Studio之前启动PowerShell(这只是意味着启动PowerShell然后启动Visual Studio吗?)
  • 以管理员身份运行PowerShell和Visual Studio
  • 以安全模式运行Visual Studio
  • 将Power Shell ExecutionProperty设置为不受限制的

Visual Studio一直在展示其他奇怪的行为,例如在尝试在特定页面上向XAML添加Click事件时一直崩溃,因此我的直觉说它不是真正的Power Shell或NuGet但是我的问题OS / Visual Studio。

除非有人有解决方案,否则我认为我只是干净地安装了Windows 8并希望能够解决这个问题。

1 个答案:

答案 0 :(得分:4)

我发现这个问题与你的问题非常相似:

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

您可以尝试解决该问题的解决方案吗?