119

I want to view the folders and sub folders in GAC. Also want to know about adding and removing from GAC.

To install we write this lines in command prompt by opening Visual Studio command prompt:-

gacutil /i [assembly path]

But to uninstall we need only:-

gacutil /u [assembly name]

Why?

Bowdzone
  • 3,827
  • 11
  • 39
  • 52
Rohit Vipin Mathews
  • 11,629
  • 15
  • 57
  • 112
  • 1
    If you go to one of the assembly folders in the Windows directory, then type a dll name you're looking for in the search bar (of file explorer), they should start showing up. – JakeJ Sep 10 '19 at 17:47

5 Answers5

154

Install:

gacutil -i "path_to_the_assembly"

View:

Open in Windows Explorer folder

  • .NET 1.0 - NET 3.5: c:\windows\assembly (%systemroot%\assembly)
  • .NET 4.x: %windir%\Microsoft.NET\assembly

OR gacutil –l

When you are going to install an assembly you have to specify where gacutil can find it, so you have to provide a full path as well. But when an assembly already is in GAC - gacutil know a folder path so it just need an assembly name.

MSDN:

sll
  • 61,540
  • 22
  • 104
  • 156
64

I'm a day late and a dollar short on this one. If you want to view the folder structure of the GAC in Windows Explorer, you can do this by using the registry:

  1. Launch regedit.
  2. Navigate to HKLM\Software\Microsoft\Fusion
  3. Add a DWORD called DisableCacheViewer and set the value to 1.

For a temporary view, you can substitute a drive for the folder path, which strips away the special directory properties.

  1. Launch a Command Prompt at your account's privilege level.
  2. Type SUBST Z: C:\Windows\assembly
    • Z can be any free drive letter.
  3. Open My Computer and look in the new substitute directory.
  4. To remove the virtual drive from Command Prompt, type SUBST Z: /D

As for why you'd want to do something like this, I've used this trick to compare GAC'd DLLs between different machines to make sure they're truly the same.

Lars Truijens
  • 42,837
  • 6
  • 126
  • 143
Rakuen42
  • 1,407
  • 15
  • 16
  • You can automate editing the registry with Powershell: – Textcape Mar 12 '20 at 00:09
  • New-Item 'HKLM:\Software\Microsoft\Fusion' -Force | New-ItemProperty -Name "DisableCacheViewer" -PropertyType DWord -Value 1 -Force | Out-Null – Textcape Mar 12 '20 at 00:10
  • To expand on your instructions (for us dummys): 1. Launch regedit 2. Navigate to Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Fusion 3. Right-click on the right side and select "New" ... "DWORD (32-bit) value" 4. Call it "DisableCacheViewer" 5. Right click the new entry "DisableCacheViewer" and select "Modify..." 6. Set the "data value" to 1. (Set it back to 0 to undo it.) – Dominic Isaia Aug 04 '22 at 18:48
46

Launch the program "Run" (Windows Vista/7/8: type it in the start menu search bar) and type: C:\windows\assembly\GAC_MSIL

Then move to the parent folder (Windows Vista/7/8: by clicking on it in the explorer bar) to see all the GAC files in a normal explorer window. You can now copy, add and remove files as everywhere else.

Julius Kunze
  • 1,035
  • 11
  • 20
9

To view the files just browse them from the command prompt (cmd), eg.:

c:\>cd \Windows\assembly\GAC_32
c:\Windows\assembly\GAC_32> dir

To add and remove files from the GAC use the tool gacutil

Klaus Byskov Pedersen
  • 117,245
  • 29
  • 183
  • 222
  • i want to view it as normal folder. – Rohit Vipin Mathews Feb 29 '12 at 11:31
  • @CodingMastero It is ***NOT*** a normal folder! – Klaus Byskov Pedersen Feb 29 '12 at 11:31
  • Cant we use some hack to view it as a normal one? – Rohit Vipin Mathews Feb 29 '12 at 11:32
  • @CodingMastero No you cannot. You can view it through the command prompt as stated above. – Klaus Byskov Pedersen Feb 29 '12 at 11:33
  • Well for .NET 4.0 you can view it as a normal folder in Explorer, because there is no longer a shell extension that hides the physical layout. **However**, just asking for the possibility to do that worries me. :-) – Christian.K Feb 29 '12 at 11:35
  • @Christian.K I agree with the latter, and am puzzled by the former. Shell extensions are pertinent to the OS and not the framework version. I have .Net4.0 installed on my Win7 machine, and I cannot browse `c:\Windows\assembly` as a normal folder. – Klaus Byskov Pedersen Feb 29 '12 at 11:39
  • 2
    Yes. Sorry I may not have been clear here. You cannot use `C:\Windows\assembly` to browse the .NET 4.0 GAC. Of course you can still use it with .NET 2/3 (if that is installed as well). There is no comparable shell extensions (AFAIK) that works in the same way for the new `C:\Windows\Microsoft.NET\assembly` directory. – Christian.K Feb 29 '12 at 13:56
  • 1
    @KlausByskovPedersen Actually, you can view it as a normal folder. See my answer for two methods of doing it. – Rakuen42 Aug 14 '13 at 21:51
  • @RohitVipinMathews If you really want to see the "C:\Windows\assembly" folder as a normal folder in Windows Explorer you can rename / delete the file Desktop.ini: `Start CMD.EXE as Admin` `CD /D C:\Windows\assembly` `ATTRIB -H -S Desktop.ini` `REN Desktop.ini Desktop.ini-DISABLED` Then (close and) reopen the explorer window. – WebDancer May 11 '18 at 09:27
7

You install as assemblies by using:

  • A setup program, that you author for your application.
  • Using the gacutil.exe tool with the -i option from the command line.
  • Dropping the assembly in %windir%\Assembly (only up to .NET 3.5, CLR 2.0)

You view the content of the GAC using:

  • The gacutil.exe tool with the -l option.
  • For .NET 2.0, 3.0 and 3.5 (CLR 2.0) browsing to %windir%\assembly using the Windows Explorer.

Note that the (physical) GAC location has changed for .NET 4.0. It is no longer in %windir%\Assembly, but now in %windir%\Microsoft.NET\assembly. However, you should never write any code that depends on the physical location anyway, because given the tools available that is hardly necessary (some "cool" homegrown system diagnostics tools aside).

Christian.K
  • 47,778
  • 10
  • 99
  • 143