letgenerateDocs()=tracefn"Generating docs."Target"GenerateDocs"(fun_->generateDocs())Target"Watch"(fun_->usewatcher=!!"docs/**/*.*"|>WatchChanges(funchanges->tracefn"%A"changesgenerateDocs())System.Console.ReadLine()|>ignore//Needed to keep FAKE from exitingwatcher.Dispose()// Use to stop the watch from elsewhere, ie another task.)

Now run build.fsx and make some changes to the docs directory. They should be printed out to the console as they happen,
and the GenerateDocs target should be rerun.

If you need to watch only a subset of the files, say you want to rerun tests as soon as the compiled DLLs change:

1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17:

letrunTests()=tracefn"Running tests."Target"RunTests"(fun_->runTests())Target"Watch"(fun_->usewatcher=!!"tests/**/bin/debug/*.dll"|>WatchChanges(funchanges->tracefn"%A"changesrunTests())System.Console.ReadLine()|>ignore//Needed to keep FAKE from exitingwatcher.Dispose()// Use to stop the watch from elsewhere, ie another task.)

Do note that FAKE will only ever run a target once within a session, so Run "RunTests" inside of WatchChanges
would only run the RunTests target once.

The Windows file watcher does not appear to be able to correctly identify changes that occur within a folder shared by Parallels between Mac OSX and Windows. If you want to run WatchChanges, you will need to run your FAKE script from Mac OSX.

At this time, only Parallels is known to have this problem, but you should assume that any other virtualization solutions will have the same problem. If you confirm a similar problem with other Linux distros or VM platforms, please update this document accordingly.