public void CheckForChange() { if (timeStamp != File.GetLastWriteTimeUtc(path)) { if (Reference != null) { foreach (var solution in IdeApp.Workspace.GetAllSolutions()) { var workspace = TypeSystemService.GetWorkspace(solution); foreach (var projId in InUseBy) { if (workspace.CurrentSolution.ContainsProject(projId)) { workspace.OnMetadataReferenceRemoved(projId, Reference); } } } } CreateNewReference(); if (Reference != null) { foreach (var solution in IdeApp.Workspace.GetAllSolutions()) { var workspace = TypeSystemService.GetWorkspace(solution); foreach (var projId in InUseBy) { if (workspace.CurrentSolution.ContainsProject(projId)) { workspace.OnMetadataReferenceAdded(projId, Reference); } } } } } }
public void CheckForChange() { if (timeStamp != File.GetLastWriteTimeUtc(path)) { if (Reference != null) { foreach (var solution in IdeApp.Workspace.GetAllSolutions()) { var workspace = TypeSystemService.GetWorkspace(solution); foreach (var projId in InUseBy) { while (true) { var project = workspace.CurrentSolution.GetProject(projId); if (project == null) { break; } if (workspace.TryApplyChanges(project.RemoveMetadataReference(Reference).Solution)) { break; } } } } } CreateNewReference(); if (Reference != null) { foreach (var solution in IdeApp.Workspace.GetAllSolutions()) { var workspace = TypeSystemService.GetWorkspace(solution); foreach (var projId in InUseBy) { while (true) { var project = workspace.CurrentSolution.GetProject(projId); if (project == null) { break; } if (workspace.TryApplyChanges(project.AddMetadataReference(Reference).Solution)) { break; } } } } } } }