views:

847

answers:

5

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.)

A: 

"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.

o.k.w
I know that. But how do you 'browse' to that subfolder. Windows explorer won't let you. Are you implying I have to fall back to command-line compilation? There's gotta be a better way.
Frederick
Frankly, I'm very puzzled as well. In the first place, if it appears in the assembly folder, you should be able to view in "Browse" tab of the "Add Reference dialog. Sorry pal, hope someone else can help here.
o.k.w
+2  A: 

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>"
Sheng Jiang 蒋晟
+1  A: 

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.

Frederick
A: 

Use this command under Visual studio command prompt

regsvr32 /u shfusion.dll

ss
+1  A: 

Hi,

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.

Regards Muse VSExtensions

Muse VSExtensions