.netPlus / Samples / .NET

 

GacTool and the Fusion History Disk Cleanup Handler

VBBubble screenshotGacTool screenshot

 

Filename: gactool.zip
Last update: 07/05/03
Size: 21 kb

 

Overview
GacTool is a console application that demonstrates how to use much of the Fusion COM API that is used to manipulate the Global Assembly Cache (GAC), NGEN cache and Download cache. GacTool basicly dumps as much information as possible about each assembly in the cache you view. When the first version of this sample was released, the Fusion APIs were mostly undocumented, and one had to work with ILDASM to figure out how it worked. Since then, Microsoft have published a Knowledge Base article (317540 - DOC: Global Assembly Cache (GAC) APIs Are Not Documented in the .NET Framework Software Development Kit (SDK) Documentation) that documents most of the public API. For those who want the full picture, I recommend taking a look at the Fusion implementation included with Rotor/SSCLI.

Included is also a Disk Cleanup Handler for removing Fusion history files (which is basicly just an INI file, used by the .NET Application Restore wizard among other things) that are no longer needed because they refer to deleted EXE files. If you're like me and create a bunch of small test applications that you then delete, you may eventually get lots of unneeded history files left, and Fusion doesn't seem to have any cleanup functionality of its own. This sample demonstrates how to build a DCH in managed code, and how to use the IHistoryReader interface to enumerate and read the history files.

The DCH must be registered for it to work. Either flip on the Register for COM Interop option in the project properties and rebuild, or run "RegAsm /codebase FusionHistoryDCH.dll" from the command line.

 

 

2000-2023, .netPlus