5

从 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 一直表现出其他奇怪的行为,例如在尝试将 Click 事件添加到特定页面上的 XAML 时持续崩溃,因此我的直觉说这不是真正的 Power Shell 或 NuGet,而是我的 OS/Visual 的问题工作室。

除非有人有解决方案,否则我认为我只能对 Windows 8 进行全新安装并希望能够修复它。

4

1 回答 1

4

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

在 Windows 8 RTM 上的 .NET 应用程序中嵌入 Powershell v2.0

你能尝试解决这个问题,看看它是否能解决问题吗?

于 2013-01-08T22:26:08.230 回答