.NET Core 3.1
There is a newer version of this package available.
See the version list below for details.
dotnet add package G2Development.FileWatcher --version
NuGet\Install-Package G2Development.FileWatcher -Version
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="G2Development.FileWatcher" Version="" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add G2Development.FileWatcher --version
#r "nuget: G2Development.FileWatcher,"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install G2Development.FileWatcher as a Cake Addin
#addin nuget:?package=G2Development.FileWatcher&version=

// Install G2Development.FileWatcher as a Cake Tool
#tool nuget:?package=G2Development.FileWatcher&version=

File Watcher

A File Watching module similar to FileSystemWatcher from Microsoft. The need arose to find a Watching module to monitor file changes inside of a Docker container where the files might be changed by the Host computer. It seems as if these changes is not monitored by FileSystemWatcher.

An attempt was made to keep the naming conventions very close to that of the FileSystemWatcher where possible. The usage will also be similar. Have a look at Diferences and Official Page


The following example creates a FileWatcher to watch the directory specified at run time. The component is set to watch for changes of any Notification type in the directory. This is similare to FileSystemWatcher.

public class Watcher
    public static void Main()

    private static void Run()
        string path = "../../../test";

        // Create a new FileWatcher and set its properties.
        using FileWatcher watcher = new FileWatcher
            Path = path,

            // Watch for changes in LastAccess and LastWrite times, and
            // the renaming of files or directories.
            NotifyFilter = NotifyFilters.LastAccess
                                | NotifyFilters.LastWrite
                                | NotifyFilters.FileName
                                | NotifyFilters.DirectoryName,

            IncludeSubdirectories = true,

            // Only watch text files.
            Filter = "*.txt"

        // Add event handlers.
        watcher.Changed += OnChanged;
        watcher.Created += OnChanged;
        watcher.Deleted += OnChanged;
        watcher.Renamed += OnRenamed;

        // Begin watching.
        watcher.EnableRaisingEvents = true;

        // Wait for the user to quit the program.
        Console.WriteLine("Press 'q' to quit the sample.");
        while (Console.Read() != 'q') ;

    // Define the event handlers.
    private static void OnChanged(object source, FileSystemEventArgs e) =>
        // Specify what is done when a file is changed, created, or deleted.
        Console.WriteLine($"File: {e.FullPath} {e.ChangeType}");

    private static void OnRenamed(object source, RenamedEventArgs e) =>
        // Specify what is done when a file is renamed.
        Console.WriteLine($"File: {e.OldFullPath} renamed to {e.FullPath}");

Note the above example has been taken from Microsoft's site to illustrate similarities.

Refer to Project Page for more information.



  • Add Error event.
  • Improved Error handling.


  • Brought more in line with FileSystemWatcher
  • Added a Wrapper Class.
  • Some breaking Changes between version 1 and 2 to bring it in line with FileSystemWatcher and Wrapper Usage.


  • Initial Release.
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp3.1 is compatible. 
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.
  • .NETCoreApp 3.1

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated 6,653 9/29/2020 429 9/29/2020 418 9/29/2020
2.0.1 357 9/29/2020
2.0.0 353 9/28/2020
1.0.1 422 9/25/2020
1.0.0 446 9/25/2020

FileWatcher brought more in line with FileSystemWatcher and added an additional FileWatcherWrapper class.