包管理器控制台不工作 Visual Studio 2013

Package Manager Console not working Visual Studio 2013

这是我打开它时得到的,以前有人遇到过这个问题吗?从来没有发生在我身上:

Could not find file 'C:\Windows\SysWOW64\WindowsPowerShell\v1.0\typesv3.ps1xml'.
Could not find file 'C:\Windows\SysWOW64\WindowsPowerShell\v1.0\Event.Format.ps1xml'.
Could not find file 'C:\Windows\SysWOW64\WindowsPowerShell\v1.0\Event.Format.ps1xml'.

更新:将这些条目添加到 devenv.config 后,现在我得到:

There were errors in loading the format data file: C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO 12.0\COMMON7\IDE\EXTENSIONS\AUEN3JAD.VIJ\Modules\NuGet\NuGet.Format.ps1xml, Error in file C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO 12.0\COMMON7\IDE\EXTENSIONS\AUEN3JAD.VIJ\Modules\NuGet\NuGet.Format.ps1xml: '', hexadecimal value 0x13, is an invalid character. Line 311, position 36.
There were errors in loading the format data file: C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO 12.0\COMMON7\IDE\EXTENSIONS\AUEN3JAD.VIJ\Modules\NuGet\NuGet.Format.ps1xml, Error in file C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO 12.0\COMMON7\IDE\EXTENSIONS\AUEN3JAD.VIJ\Modules\NuGet\NuGet.Format.ps1xml: '', hexadecimal value 0x13, is an invalid character. Line 311, position 36.

尝试将这些行添加到运行时部分的 devenv.exe.config 文件中。可能有用。

 <runtime>
  <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
    <dependentAssembly>
        <assemblyIdentity name="System.Management.Automation" publicKeyToken="31bf3856ad364e35" />
        <publisherPolicy apply="no" />
      </dependentAssembly>
    <dependentAssembly>
      <assemblyIdentity name="Microsoft.PowerShell.Commands.Utility" publicKeyToken="31bf3856ad364e35" />
      <publisherPolicy apply="no" />
    </dependentAssembly>
    <dependentAssembly>
      <assemblyIdentity name="Microsoft.PowerShell.ConsoleHost" publicKeyToken="31bf3856ad364e35" />
      <publisherPolicy apply="no" />
    </dependentAssembly>
    <dependentAssembly>
      <assemblyIdentity name="Microsoft.PowerShell.Commands.Management" publicKeyToken="31bf3856ad364e35" />
      <publisherPolicy apply="no" />
    </dependentAssembly>
    <dependentAssembly>
      <assemblyIdentity name="Microsoft.PowerShell.Security" publicKeyToken="31bf3856ad364e35" />
      <publisherPolicy apply="no" />
    </dependentAssembly>
    <dependentAssembly>
      <assemblyIdentity name="Microsoft.PowerShell.Commands.Diagnostics" publicKeyToken="31bf3856ad364e35" />
      <publisherPolicy apply="no" />
    </dependentAssembly>
    </assemblyBinding>
</runtime>

添加上面指示的行适用于 VS2013,但后来我在 VS2015 上遇到了同样的问题,但它在那里不起作用。在这里起作用的是 Ed Vowles 的评论:https://github.com/NuGet/Home/issues/2836:

"I was able to resolve this problem by installing (or reinstalling) PowerShell from here https://www.microsoft.com/en-us/download/details.aspx?id=50395 (choosing this version: Win7AndW2K8R2-KB3134760-x64.msu for my windows 7 machine) and restarting."

为此,请单击“开始”,在“搜索”框中键入命令提示符或 cmd,右键单击“命令提示符”,然后以管理员身份单击 运行。如果系统提示您输入管理员密码或进行确认,请键入密码或单击“允许”。

输入命令
C:\windows\system32>sfc /scannow