private void UpdateProject(string projectDirectory) { _logger.LogInformation($"Update project {projectDirectory}"); var contexts = _workspaceContext.GetProjectContexts(projectDirectory); if (!contexts.Any()) { _logger.LogWarning($"Cannot create any {nameof(ProjectContext)} from project {projectDirectory}"); return; } _projectStates.Update(projectDirectory, contexts, AddProject, RemoveProject); var projectFilePath = contexts.First().ProjectFile.ProjectFilePath; _fileSystemWatcher.Watch(projectFilePath, (file, changeType) => { _logger.LogInformation($"Watcher: {file} updated."); Update(allowRestore: true); }); _fileSystemWatcher.Watch(Path.ChangeExtension(projectFilePath, "lock.json"), (file, changeType) => { _logger.LogInformation($"Watcher: {file} updated."); Update(allowRestore: false); }); }
private void UpdateProject(string projectDirectory) { _logger.LogInformation($"Update project {projectDirectory}"); var contexts = _workspaceContext.GetProjectContexts(projectDirectory); if (!contexts.Any()) { _logger.LogWarning($"Cannot create any {nameof(ProjectContext)} from project {projectDirectory}"); return; } var projectFilePath = contexts.First().ProjectFile.ProjectFilePath; _emitter.Emit( EventTypes.ProjectChanged, new ProjectInformationResponse() { // the key is hard coded in VSCode { "DnxProject", new { Path = projectFilePath, SourceFiles = Enumerable.Empty <string>() } } }); _projectStates.Update(projectDirectory, contexts, AddProject, _omnisharpWorkspace.RemoveProject); _watcher.Watch(projectFilePath, file => { _logger.LogInformation($"Watcher: {file} updated."); Update(true); }); _watcher.Watch(Path.ChangeExtension(projectFilePath, "lock.json"), file => { _logger.LogInformation($"Watcher: {file} updated."); Update(false); }); }