为什么NuGet在更新到VS Update 3后无法在Visual Studio 2012中加载



更新到Visual Studio 2012 Update 3(我以前运行的是Update 2)后,NuGet无法加载。我的意思是,在我加载了一个使用NuGet并曾经工作过的解决方案后,包管理器不再出现。*它不会显示在"工具"菜单下。*右键单击解决方案后,NuGet(管理NuGet包)不会显示在菜单中*右键单击项目后,NuGet(管理NuGet包)不会显示在菜单中

"扩展和更新"对话框(TOOLS/Extensions and Updates…)确实显示NuGet Package Manager已安装,当我单击它时,它显示可以卸载它。

此外,当我在卸载后检查安装日志,然后重新安装NuGet Package Manager(从我在CodePlex NuGet网站上获得的下载)时,它显示它已成功安装:

 /10/2013 11:39:05 AM - Beginning to install extension to Microsoft Visual Studio Professional 2012...
7/10/2013 11:39:05 AM - Install to Microsoft Visual Studio Professional 2012 completed successfully. The extension has been installed to C:PROGRAM FILES (X86)MICROSOFT VISUAL STUDIO 11.0\COMMON7IDEEXTENSIONSVYALGTD2.XZS

我检查了一下,这个文件夹确实存在,并且包含NuGet dll。

当我转到工具/选项。。。对话框,然后选择Package Manager。右侧窗格显示文本:"加载此属性页时出错"。当展开"程序包管理器"并选择"常规"或"程序包源"时,会显示相同的文本。

我已经卸载和重新安装了无数次NuGet,我从下载的VSIX和直接在"扩展和更新"对话框中安装了这两个程序,结果总是一样的。

我安装了一个旧版本的NuGet,得到了相同的结果。我已经卸载并重新安装了Visual Studio,并且在版本1、更新2或更新3中得到了相同的结果。

Activity.log.xml文件在尝试加载NuGet:时显示以下问题

<entry>
  <record>211</record>
  <time>2013/07/10 17:39:44.295</time>
  <type>Information</type>
      <source>Microsoft.VisualStudio.CommonIDE.ExtensibilityHosting.VsShellComponentModelHost</source>
<description>Successfully loaded component assembly from cache</description>
<path>C:PROGRAM FILES (X86)MICROSOFT VISUAL STUDIO 11.0COMMON7IDEEXTENSIONSVYALGTD2.XZSNuGet.VisualStudio.dll</path>
</entry>
<entry>
  <record>212</record>
  <time>2013/07/10 17:39:44.295</time>
  <type>Information</type>
  <source>Microsoft.VisualStudio.CommonIDE.ExtensibilityHosting.VsShellComponentModelHost</source>
  <description>Successfully loaded component assembly from cache</description>
  <path>C:PROGRAM FILES (X86)MICROSOFT VISUAL STUDIO 11.0COMMON7IDEEXTENSIONSVYALGTD2.XZSNuGet.Console.dll</path>
</entry>
<entry>
  <record>213</record>
  <time>2013/07/10 17:39:44.295</time>
  <type>Information</type>
  <source>Microsoft.VisualStudio.CommonIDE.ExtensibilityHosting.VsShellComponentModelHost</source>
  <description>Successfully loaded component assembly from cache</description>
  <path>C:PROGRAM FILES (X86)MICROSOFT VISUAL STUDIO 11.0COMMON7IDEEXTENSIONSVYALGTD2.XZSNuGetConsole.Host.PowerShellProvider.dll</path>
</entry>
<entry>
  <record>214</record>
  <time>2013/07/10 17:39:44.298</time>
  <type>Information</type>
  <source>VisualStudio</source>
  <description>End package load [Visual Studio Component Model Host Package]</description>
  <guid>{49D12072-378B-4FFA-A09E-40E0B5D097CC}</guid>
</entry>
<entry>
  <record>215</record>
  <time>2013/07/10 17:39:44.383</time>
  <type>Information</type>
  <source>VisualStudio</source>
  <description>End package load [Microsoft.VisualStudio.Editor.Implementation.EditorPackage]</description>
  <guid>{E269B994-EF71-4CE0-8BCD-581C217372E8}</guid>
</entry>

这个部分看起来还可以。但是有以下警告和错误:

<entry>
  <record>234</record>
  <time>2013/07/10 17:39:57.070</time>
  <type>Warning</type>
  <source>VisualStudio</source>
  <description>Performance warning: String load failed. Pkg:{00000000-0000-0000-0000-000000000000} LANG:0409 ID:1003&#x000D;&#x000A;</description>
</entry>
<entry>
  <record>235</record>
  <time>2013/07/10 17:39:57.072</time>
  <type>Warning</type>
  <source>VisualStudio</source>
  <description>Performance warning: String load failed. Pkg:{00000000-0000-0000-0000-000000000000} LANG:0409 ID:1004&#x000D;&#x000A;</description>
</entry>
<entry>
  <record>236</record>
  <time>2013/07/10 17:39:57.073</time>
  <type>Warning</type>
  <source>VisualStudio</source>
  <description>Performance warning: String load failed. Pkg:{5FB7364D-2E8C-44A4-95EB-2A382E30FEC7} (EditorExtensionsPackage) LANG:0409 ID:101&#x000D;&#x000A;</description>
</entry>
<entry>
  <record>237</record>
  <time>2013/07/10 17:39:57.073</time>
  <type>Warning</type>
  <source>VisualStudio</source>
  <description>Performance warning: String load failed. Pkg:{5FB7364D-2E8C-44A4-95EB-2A382E30FEC7} (EditorExtensionsPackage) LANG:0409 ID:106&#x000D;&#x000A;</description>
</entry>
<entry>
  <record>238</record>
  <time>2013/07/10 17:39:57.073</time>
  <type>Warning</type>
  <source>VisualStudio</source>
  <description>Performance warning: String load failed. Pkg:{5FB7364D-2E8C-44A4-95EB-2A382E30FEC7} (EditorExtensionsPackage) LANG:0409 ID:102&#x000D;&#x000A;</description>
</entry>
<entry>
  <record>239</record>
  <time>2013/07/10 17:39:57.073</time>
  <type>Warning</type>
  <source>VisualStudio</source>
  <description>Performance warning: String load failed. Pkg:{5FB7364D-2E8C-44A4-95EB-2A382E30FEC7} (EditorExtensionsPackage) LANG:0409 ID:101&#x000D;&#x000A;</description>
</entry>
<entry>
  <record>240</record>
  <time>2013/07/10 17:39:57.074</time>
  <type>Warning</type>
  <source>VisualStudio</source>
  <description>Performance warning: String load failed. Pkg:{5FB7364D-2E8C-44A4-95EB-2A382E30FEC7} (EditorExtensionsPackage) LANG:0409 ID:107&#x000D;&#x000A;</description>
</entry>
<entry>
  <record>241</record>
  <time>2013/07/10 17:39:57.074</time>
  <type>Warning</type>
  <source>VisualStudio</source>
  <description>Performance warning: String load failed. Pkg:{5FB7364D-2E8C-44A4-95EB-2A382E30FEC7} (EditorExtensionsPackage) LANG:0409 ID:103&#x000D;&#x000A;</description>
</entry>
<entry>
  <record>242</record>
  <time>2013/07/10 17:39:57.074</time>
  <type>Warning</type>
  <source>VisualStudio</source>
  <description>Performance warning: String load failed. Pkg:{5FB7364D-2E8C-44A4-95EB-2A382E30FEC7} (EditorExtensionsPackage) LANG:0409 ID:105&#x000D;&#x000A;</description>
</entry>
<entry>
  <record>243</record>
  <time>2013/07/10 17:39:57.074</time>
  <type>Warning</type>
  <source>VisualStudio</source>
  <description>Performance warning: String load failed. Pkg:{5FB7364D-2E8C-44A4-95EB-2A382E30FEC7} (EditorExtensionsPackage) LANG:0409 ID:104&#x000D;&#x000A;</description>
</entry>
<entry>
  <record>244</record>
  <time>2013/07/10 17:40:00.908</time>
  <type>Information</type>
  <source>VisualStudio</source>
  <description>Entering function CVsPackageInfo::HrInstantiatePackage</description>
  <guid>{5FCC8577-4FEB-4D04-AD72-D6C629B083CC}</guid>
</entry>
<entry>
  <record>245</record>
  <time>2013/07/10 17:40:00.908</time>
  <type>Information</type>
  <source>VisualStudio</source>
  <description>Begin package load [NuGet.Tools.NuGetPackage, NuGet.Tools, Version=2.6.40627.9000, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a]</description>
  <guid>{5FCC8577-4FEB-4D04-AD72-D6C629B083CC}</guid>
</entry>
<entry>
  <record>246</record>
  <time>2013/07/10 17:40:00.915</time>
  <type>Error</type>
  <source>VisualStudio</source>
  <description>CreateInstance failed for package [NuGet.Tools.NuGetPackage, NuGet.Tools, Version=2.6.40627.9000, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a]</description>
  <guid>{5FCC8577-4FEB-4D04-AD72-D6C629B083CC}</guid>
  <hr>80070002</hr>
  <errorinfo>Could not load file or assembly 'NuGet.Tools, Version=2.6.40627.9000, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.</errorinfo>
</entry>
<entry>
  <record>247</record>
  <time>2013/07/10 17:40:00.915</time>
  <type>Error</type>
  <source>VisualStudio</source>
  <description>End package load [NuGet.Tools.NuGetPackage, NuGet.Tools, Version=2.6.40627.9000, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a]</description>
  <guid>{5FCC8577-4FEB-4D04-AD72-D6C629B083CC}</guid>
  <hr>80004005 - E_FAIL</hr>
  <errorinfo>Could not load file or assembly 'NuGet.Tools, Version=2.6.40627.9000, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.</errorinfo>
</entry>
<entry>
  <record>248</record>
  <time>2013/07/10 17:40:00.915</time>
  <type>Warning</type>
  <source>VisualStudio</source>
  <description>Package failed to load; error message suppressed by skip flag</description>
  <guid>{5FCC8577-4FEB-4D04-AD72-D6C629B083CC}</guid>
</entry>
<entry>

主要线索在记录246中——无法加载文件或程序集'NuGet.Tools,Version=2.6.40627.9000,Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a'或其依赖项之一。系统找不到指定的文件

问题是系统为什么找不到文件,或者缺少什么依赖项。MSDN技术支持正在帮助我,但后来决定这是一个他们不会支持的问题,我应该在这里发布这个问题。

看看这个到coops007的链接,它为NuGet问题提供了一个很好的解决方案。

以下是解决问题的步骤,对@Catherine:有效

  1. 从web下载Nuget-vsix包,而不是通过VS2012中的VS扩展库
  2. 确保VS2012已完全关闭
  3. 运行两次VSIX安装程序(同时运行!)第一次将安装,第二次表示已安装。这是第二个真正完成任务的安装程序

注意,如果只运行一次安装程序,VS2012中的错误仍然存在。此外,如果再次重新运行安装程序,错误仍然存在您必须同时运行两次安装程序

此场景适用于我:

  • 下载NuGet软件包管理器vsix文件
  • 像压缩档案一样提取
  • 将内容复制到NuGet扩展名所在的文件夹已安装(在我的系统上是"c:\Program Files(x86)\MicrosoftVisual Studio 11.0\Common7\IDE\Extensions\oabo2crw.lk3")

如果它有帮助

我的"NuGet.Tools"也出现了Could not load file or assembly错误。我在Windows 8.1上运行Visual Studio Professional 2012,(在尝试了许多其他推荐的解决方案后)以下步骤对我有效:

  1. 以管理员身份运行VS2012(此时我所做的一切都是以管理员身份进行的…以防万一)
  2. 已从Tools菜单中的Extensions and Updates...对话框中卸载NuGet Package Manager
  3. 已重新启动Visual Studio
  4. 从他们的网站下载了"Nuget.Tools.vsix"文件。当选择NuGet软件包时,您可以单击Extensions and Updates...对话框软件包信息部分的更多信息链接来找到它
  5. 关闭Visual Studio 2012
  6. 以管理员身份运行powershell
  7. 导航到我保存.VSIX文件的位置
  8. 从powershell运行.VSIX文件

所以本质上,我只是使用powershell手动安装了这个包。在那之后,我重新启动了Visual Studio,没有出现任何错误。

我在Visual Studio 2015社区版上遇到了同样的错误。在我的案例中,只需转到"工具">"扩展和更新"并卸载"Nuget Package Manager for Visual Studio",重新启动Visual Studio,然后再次安装此扩展即可解决问题。现在工作非常完美,没有任何错误。也许安装程序现在已经简化了,所以只需重新安装就可以解决问题。

这让我死了一段时间。最终删除了中一个古怪的命名文件夹

C:Program Files (x86)Microsoft Visual Studio 11.0Common7IDEExtensions 

我的是qlpuoyw3.ayw,并从.vsix文件重新安装。像冠军一样工作。还清除了与其他扩展相同的错误。

我解决了这个特定的问题,但它只是让我进入下一个问题。以下是我为解决这个问题所做的,我希望它能帮助其他人:

  1. 卸载Visual Studio 2012(控制面板-程序和功能-Microsoft Visual Studio Professional 2012)
  2. 删除VS 2012"程序文件"one_answers"程序文件(x86)"下的文件夹。实际名称是Microsoft Visual Studio 11.0(卸载效果很差不删除文件夹)
  3. 从注册表中删除VS 2012项HKEY_CURRENT_USER和HKEY_LOCAL_MACHINE(它们将是11.0Visual Studio下的条目)
  4. 重新安装Visual Studio 2012(我得到了MSDN订阅下载的版本)

这解决了包管理器的问题,但我遇到了另一个问题,即Web.Mvc.Package.MvcPackage无法正确加载,然后我的解决方案将不再识别我所拥有的解决方案的项目文件,因为它表明它不兼容。因此,我将重新卸载并删除Visual Studio 2012下与MVC 4相关的所有条目(文件夹和注册表),然后重新安装。

最新更新