How to view the Folder and Files in GAC?

前端 未结 5 2064
生来不讨喜
生来不讨喜 2020-12-12 11:24

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

相关标签:
5条回答
  • 2020-12-12 12:02

    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:

    • How to: Install an Assembly into the Global Assembly Cache
    • How to: View the Contents of the Global Assembly Cache
    0 讨论(0)
  • 2020-12-12 12:11

    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

    0 讨论(0)
  • 2020-12-12 12:15

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

    0 讨论(0)
  • 2020-12-12 12:19

    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.

    0 讨论(0)
  • 2020-12-12 12:25

    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.
      • If you elevate your privileges, you might not see the drive in Windows 7.
    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.

    0 讨论(0)
提交回复
热议问题