Unable to add reference in Visual Studio 2012 'ReferenceManagerPackage'

天大地大妈咪最大 提交于 2020-01-13 18:06:32

问题


Recently i encountered this issue whereby whenever i right-click "Add Reference..." it give me an error as stated below.

Package 'ReferenceManagerPackage' failed to load.

Attempted to reinstall Visual studio 2012 however it still doesn't work.

hasn't meet this issue before.

EDIT: 512 2013/04/14 00:49:11.860 Error VisualStudio CreateInstance failed for package [ReferenceManagerPackage] {48D4A2C1-02AD-4F18-9153-620511BACB7B}


80131522 Could not load type 'Microsoft.VisualStudio.Shell.Interop.IVsReferenceManager2' from assembly 'Microsoft.VisualStudio.Shell.Interop.11.0, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.

回答1:


I had this issue before. If I remember the reason for this, basically you have that particular binary in your gac. I'm guessing you recently updated Visual Studio. Although it patched the dll on disk, it is likely loading the dll from the gac, which hasn't been updated. Just regac the dll and you should be fine.

EDIT

Sorry, that's my bad. regac isn't an actual command,I just mean you have to add the item to the gac again.

Start a visual studio command prompt and run this command gacutil /i <path_to_assembly>,




回答2:


I just got this error after installation of Visual Studio 2017.

The solution was as follows.

  1. Launch Developer Command Prompt for VS 2017
  2. CD C:\Program Files\Microsoft Visual Studio\2017\Community\Common7\IDE\PublicAssemblies
  3. Run gacutil -i Microsoft.VisualStudio.Shell.Interop.11.0.dll

You should now see

Microsoft (R) .NET Global Assembly Cache Utility.  Version 4.0.30319.0
Copyright (c) Microsoft Corporation.  All rights reserved.

Assembly successfully added to the cache

Restart Visual Studio and hopefully all will be well and you can add references.

The file C:\Users\USER\AppData\Roaming\Microsoft\VisualStudio\15.0_cc9cc69a\ActivityLog.xml is useful for debugging any other assemblies that may be causing the issue. Annoyingly it's very tempting to click No when asked never to see the error message again, which will suppress the error and this path so I thought I'd post it here for reference.




回答3:


I've just had the same error (how I got it was different) and adding the assembly back into the GAC did the trick for me. From a VS 2012 command prompt (as admin) I typed...

gacutil -i Microsoft.VisualStudio.Shell.Interop.11.0.dll

Now, my situation differs in that I had to un-install VS 2012 Update 2 (as it had messed up my source control, I couldn't check anything in). After doing a system restore to an earlier date I couldn't open the add-reference dialog in VS 2012. I hunted for this DLL on disk but it was gone, so I copied it from another machine, added it to the GAC and voila, I'm back up and running again.




回答4:


On my workstation, I don't have the VS Shell Interop DLL, since I don't have Visual Studio SDK installed. To perform this feat, you'd need to grab SDK from Download Center -> Microsoft Visual Studio 2012 SDK. I bet the problem will go away once it's installed.

To really troubleshoot this, I would attach with another Visual Studio or some other debugger, and set it to break on first chance of Type Load Exception. Then inspect your call stack and report it here.



来源:https://stackoverflow.com/questions/15986541/unable-to-add-reference-in-visual-studio-2012-referencemanagerpackage

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!