Why can't I find a shared assembly I added to the GAC?

  • Thread starter Thread starter Bill
  • Start date Start date
B

Bill

I created a shared assemble and dropped it into Windows\assembly. Browsing
this directory shows that it is in there and the properties looks as
expected. However, when I attempt to add this as a reference in the IDE, the
name is not showing.

Am I missing something?
 
Adding An assenbly into GAC, does not mean you can see it in "Add
References" dialog box in VS.NET. To make the shared assembly show up in the
"ADd Reference" dialog box, you need add a correspoding entry in Windows
registry:
"HKEY_LOCAL_MACHINE_SOFTWARE\Microsoft\.NETFramework\AssemblyFolders"

But whether the assembly is shown in the "Add Reference" dialog box or not,
does not affect the use of the shared assembly. When you in a project that
need to reference the shared assembly, you can just point to the eference to
the shared assembly's project.

When a app that uses the shared assemly running, it alway looking for the
shared assemly in the GAC first, if not found then it will search other
places, as the app is configured.
 
Bill,

As the others have said, modifying the registry seems to be the prefered
way. However, this is not hte only way.. What I normally do, is place a copy
of the assembly in [$program files]\Microsoft.NET\Primary Interop Assemblies
directory.

This will add the assembly to the list in the reference screen, but your
code will actually use the version in the gac at runtime..

Hope this helps..

Cheers
 
Back
Top