1

I am facing a strange issue with FileSystemWatcher. The folder am watching is "publishing". The file am watching is "settings.json" which is in publishing folder inside one project

Problem : When settings.json is changed inside visual studio 2019 the event is not triggered but the file is saved, When settings.json is changed outside of visual studio i.e in file explorer the event is triggered and then the file is saved.

Any solution or alternatives of using FileSystemWatcher?

            FileSystemWatcher publishWatcher = new FileSystemWatcher(DestinationDirectory + "\\publishing")
            {
                Filter = "settings.json"
                EnableRaisingEvents = true
            };
            publishWatcher.Changed += new FileSystemEventHandler(PublishPackageChanged);

          private void PublishPackageChanged(object sender, FileSystemEventArgs e)
          {
          }
Diksha Mundhra
  • 121
  • 2
  • 12
  • Maybe this will help https://stackoverflow.com/questions/16278783/filesystemwatcher-not-firing-events – Anthony McGrath Apr 25 '20 at 01:20
  • Based on my test, I have reproduced your problem. This problem may be an issue. You can report it in [Developer Community](https://developercommunity.visualstudio.com/spaces/8/index.html). – Jack J Jun Apr 27 '20 at 06:30

0 Answers0