4
I would like to make a code, which when it is executed, I would know if the solution has been changed and which project has been changed, but I do not know if there is a method to be used. Then I’d like your help.
4
I would like to make a code, which when it is executed, I would know if the solution has been changed and which project has been changed, but I do not know if there is a method to be used. Then I’d like your help.
4
There is a class in . Net that is used to monitor file system changes:
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 the notifications:
static void WatcherEvent(object sender, FileSystemEventArgs e)
{
// alterações nos arquivos ocorreram!
// verificar o argumento `e` para saber o que ocorreu.
}
Thank you very much, it fell like a glove.
Beauty... if you need help with class, tell me that I add more information on how to use.
Browser other questions tagged c# .net visual-studio
You are not signed in. Login or sign up in order to post.
Are you doing an add-in? Or would it be an application that runs parallel to Visual Studio?
– Miguel Angelo
An application running parallel to the VS.
– João Paulo Pulga