Register a Dll into the Gac - But Then It Doesn't Show Up in the Assembly Window

Register a dll into the GAC - but then it doesn't show up in the assembly window

Your code doesn't register the assembly in GAC, but, as explained here,

Registers the classes in a managed
assembly to enable creation from COM.

which is not the same.

registering a dll in GAC

While you can't (re: shouldn't) use GACUtil.exe, there are 2 other ways, outlined in the following link from msdn:

http://msdn.microsoft.com/en-us/library/dkkx7f79.aspx

What you're looking for is probably Mscorcfg.msc, but is only good for Framework version 3.5 and earlier

http://msdn.microsoft.com/en-us/library/2bc0cxhc.aspx

Gacutil.exe successfully adds assembly, but assembly not viewable in explorer. Why?

That's because you use the .NET 4.0 version of gacutil.exe. It stores the assembly in a different GAC, the one in c:\windows\microsoft.net\assembly. Where all .NET 4.0 assemblies are stored. There is no shell extension handler for that one, the folders are visible as-is. You can have a look-see with Windows Explorer, .you'll see the internal structure of the GAC folders. You shouldn't have any trouble finding your assembly back, the GAC isn't particularly complicated.

If the assembly is intended to be used by an app that targets an earlier version of .NET then you should use the .NET 2.0 version of gacutil.exe, stored in C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin

Gacutil.exe successfully adds assembly, but assembly not viewable in explorer. Why?

That's because you use the .NET 4.0 version of gacutil.exe. It stores the assembly in a different GAC, the one in c:\windows\microsoft.net\assembly. Where all .NET 4.0 assemblies are stored. There is no shell extension handler for that one, the folders are visible as-is. You can have a look-see with Windows Explorer, .you'll see the internal structure of the GAC folders. You shouldn't have any trouble finding your assembly back, the GAC isn't particularly complicated.

If the assembly is intended to be used by an app that targets an earlier version of .NET then you should use the .NET 2.0 version of gacutil.exe, stored in C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin

Why is my assembly not visible in Add Reference .Net when installed to the GAC?

Your assembly is installed to C:\WINDOWS\Microsoft.NET\assembly\ instead of C:\Windows\Assembly\ because it is a .Net 4.0 assembly and the .Net framework version 4.0 has a new separate GAC in that location. The GAC located at C:\Windows\Assembly\ contains only .Net 2.0 - 3.5 assemblies. (see .NET 4.0 has a new GAC, why?).

The list of assemblies found in Visual Studios "Add Reference -> .Net." dialog is not simply a list of assemblies found in the GAC (notice that most of the entries in that list aren't found in the GAC either).

For information on how to add your assembly to this list see the following article (specifically the "To display an assembly in the Add Reference dialog box" section):

  • How to: Add or Remove References in Visual Studio

Note that the registry key used for this is different for different versions of Visual Studio.



Related Topics



Leave a reply



Submit