Search code examples
c#.netfilesystemsgacfilesystemwatcher

Filesystemwatcher and GAC


For the Past few months I was using Filesystemwatcher to find the file system changes in the system. However When I install an Assembly in GAC, Filesystemwatcher doesnot capture the dll registered in GAC. Here is the code. Though the file is created at the location C:\Windows\assembly\GAC_MSIL\ConsoleApplication2\1.0.0.0__aea873120d858924\consoleapplication2.dll, I could not find that in the "str" variable. Instead I have the directory path of it. Does anyone have any idea where it goes wrong.

static void Main(string[] args)
    {

        str = new List<string>();
        FileSystemWatcher fs = new FileSystemWatcher(@"c:\");
        fs.IncludeSubdirectories = true;
        fs.Created += new FileSystemEventHandler(OnFileCreate);
        fs.Changed += new FileSystemEventHandler(OnFileCreate);
        fs.EnableRaisingEvents = true;
        new System.EnterpriseServices.Internal.Publish().GacInstall(@"C:\Users\jijiadmin\Documents\Visual Studio 2008\Projects\ConsoleApplication2\ConsoleApplication2\bin\Debug\consoleapplication2.dll");
        Console.ReadKey();
     }
     static void OnFileCreate(object e, FileSystemEventArgs ev)
    {
            str.Add(ev.FullPath);
    }

Solution

  • This seems to be Issue with filesystemwatcher and raised it to Microsoft. Thanks for all your replies.