G S
G S

Reputation: 36838

GAC Assembly Missing in Add Reference dialog

I have an Interop assembly lying in GAC; Windows Explorer clearly shows it listed in the C:\WINDOWS\assembly folder. Yet, when I try to add a reference to it in from Visual Studio, I can't see it anywhere in the Add Reference dialog.

If this is happened to you too, what is the reason for this? And how do I fix this?

(The assembly is actually located in C:\WINDOWS\assembly\GAC_MSIL folder, if you must know.)

Upvotes: 6

Views: 9982

Answers (7)

BALKANGraph
BALKANGraph

Reputation: 2041

I've created a tool that will help you to achieve your goal. Muse VSReferences will allow you to add a Global Assembly Cache reference to the project from Add GAC Reference menu item.

Upvotes: 3

Soundararajan
Soundararajan

Reputation: 2194

Alternatively, I edited the Project file and added the reference manually.

  1. Install the assembly in GAC. gacutil /i "Foo.dll"
  2. Find the strong name of the assembly. gacutil /l will give you the list from which you can pick.
  3. In the consuming project file add the following line (from the previous step)
  4. <Reference Include="Foo, Version=x.x, Culture=neutral, PublicKeyToken=xxx, processorArchitecture=MSIL" />
  5. And it works. :)

Upvotes: 1

HuBeZa
HuBeZa

Reputation: 4761

You can also map the GAC folder to a virtual drive, and then you can add GAC reference through browse tab.

Manual by MZ-Tools

Upvotes: 0

ss.
ss.

Reputation: 1

Use this command under Visual studio command prompt

regsvr32 /u shfusion.dll

Upvotes: -1

Sheng Jiang 蒋晟
Sheng Jiang 蒋晟

Reputation: 15271

Add one of the following registry keys, where is the directory to search, and MyAssemblies is the category of your assemblies. Note HKCU is for the current user and HKLM is for everyone on the same computer.

[HKEY_CURRENT_USER\SOFTWARE\Microsoft\.NETFramework\<version>\AssemblyFoldersEx\MyAssemblies]@="<AssemblyLocation>"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\<version>\AssemblyFoldersEx\MyAssemblies]@="<AssemblyLocation>"

Upvotes: 5

G S
G S

Reputation: 36838

As other's have pointed out, simply installing an assembly in GAC doesn't ensure it'll show up in the Add Reference Dialog Box. I've found this MSDN page that has the details. See the section To display an assembly in the Add Reference dialog box.

Upvotes: 2

o.k.w
o.k.w

Reputation: 25810

"C:\WINDOWS\assembly" is a special folder which in Windows Explorer will list the assemblies (and the assembly info) within the various sub-folders.

For your case, you might need to point it to the physical path which is "C:\Windows\assembly\GAC_MSIL.....dll" within VS.NET.

Upvotes: 0

Related Questions