detect - File Watcher in VSPackage -


i'm new in developing in visual studio hope problem not stupid :-) try establish filewatcher in vspackage detect changes performed in current solution. found class filewatcher, - in opinion - detect file changes. in code must wrong no event fired. maybe can me?

the solution want watch in d:\\test entering specific path doesn't help

class watcher {     filesystemwatcher watcher = new filesystemwatcher();      [permissionset(securityaction.demand, name = "fulltrust")]     public void startwatching()     {         debug.writeline("in watcher method");         watcher.path = @"d:\\";          watcher.notifyfilter = notifyfilters.lastaccess | notifyfilters.lastwrite            | notifyfilters.filename | notifyfilters.directoryname;          watcher.changed += new filesystemeventhandler(onchanged);         watcher.created += new filesystemeventhandler(onchanged);         watcher.deleted += new filesystemeventhandler(onchanged);         watcher.renamed += new renamedeventhandler(onrenamed);          watcher.enableraisingevents = true;     }      private static void onchanged(object source, filesystemeventargs e)     {         debug.writeline("changes in folder:" + e.fullpath);     }      private static void onrenamed(object source, renamedeventargs e)     {         debug.writeline("file: {0} renamed {1}", e.oldfullpath, e.fullpath);     }      private static void ondeleted(object source, renamedeventargs e)     {         debug.writeline("deleted");     }      private static void oncreated(object source, renamedeventargs e)     {         debug.writeline("created");     } } 

in initialize method of vspackage call: ("in watcher method" displayed in output part should work)

 watch = new watcher();         watch.startwatching(); 

tank in advance!

edit

i found out, path @ test environment changes. have problem, i'm not able name of changed file, change event gives me .opensdf or .sdf

can me?

instead of watching file changes can use built in events provided visual studio: solutionevents , projectitemevents. stack overflow post explains how use them in vs package.


Comments