I would like to make a code, which when executed, would know if the solution was changed and which project has changed, but I do not know if there is a method to take as a basis. Then I would like your help.
I would like to make a code, which when executed, would know if the solution was changed and which project has changed, but I do not know if there is a method to take as a basis. Then I would like your help.
There is a .Net class that is used to monitor changes to the file system:
With it you can make the following code to be notified whenever a file changes:
// Criar uma instância do FileSystemWatcher e configurá-la.
var watcher = new FileSystemWatcher(
"C:\MinhaSolucao\", // caminho raiz da solução a ser monitorada
"*.csproj" // vamos monitorar os arquivos 'csproj' dentro do caminho acima
);
// Adicionando os eventos para notificação de alterações.
watcher.Changed += new FileSystemEventHandler(WatcherEvent);
watcher.Created += new FileSystemEventHandler(WatcherEvent);
watcher.Deleted += new FileSystemEventHandler(WatcherEvent);
watcher.Renamed += new RenamedEventHandler(WatcherEvent);
// Iniciar o monitoramento.
watcher.EnableRaisingEvents = true;
Code receiving notifications:
static void WatcherEvent(object sender, FileSystemEventArgs e)
{
// alterações nos arquivos ocorreram!
// verificar o argumento 'e' para saber o que ocorreu.
}