internal Task HandleEndBuildAsync(BuildEventArgs args) { if (!args.Success) { // Build failed return(Task.CompletedTask); } return(_projectSnapshotManagerDispatcher.RunOnDispatcherThreadAsync((projectItem, ct) => { if (!_projectService.IsSupportedProject(projectItem)) { // We're hooked into all build events, it's possible to get called with an unsupported project item type. return; } var projectPath = _projectService.GetProjectPath(projectItem); var projectSnapshot = _projectManager.GetLoadedProject(projectPath); if (projectSnapshot != null) { var workspaceProject = _projectManager.Workspace.CurrentSolution?.Projects.FirstOrDefault( project => FilePathComparer.Instance.Equals(project.FilePath, projectSnapshot.FilePath)); if (workspaceProject != null) { // Trigger a tag helper update by forcing the project manager to see the workspace Project // from the current solution. _workspaceStateGenerator.Update(workspaceProject, projectSnapshot, CancellationToken.None); } } }, args.SolutionItem, CancellationToken.None)); }
// Internal for testing internal void ProjectOperations_EndBuild(object sender, BuildEventArgs args) { if (args == null) { throw new ArgumentNullException(nameof(args)); } _foregroundDispatcher.AssertForegroundThread(); if (!args.Success) { // Build failed return; } var projectItem = args.SolutionItem; if (!_projectService.IsSupportedProject(projectItem)) { // We're hooked into all build events, it's possible to get called with an unsupported project item type. return; } var projectPath = _projectService.GetProjectPath(projectItem); // Get the corresponding roslyn project by matching the project name and the project path. foreach (var projectSnapshot in _projectManager.Projects) { if (string.Equals(projectPath, projectSnapshot.FilePath, StringComparison.OrdinalIgnoreCase)) { _projectManager.HostProjectBuildComplete(projectSnapshot.HostProject); break; } } }
// Internal for testing internal void ProjectOperations_EndBuild(object sender, BuildEventArgs args) { if (args == null) { throw new ArgumentNullException(nameof(args)); } _foregroundDispatcher.AssertForegroundThread(); if (!args.Success) { // Build failed return; } var projectItem = args.SolutionItem; if (!_projectService.IsSupportedProject(projectItem)) { // We're hooked into all build events, it's possible to get called with an unsupported project item type. return; } var projectPath = _projectService.GetProjectPath(projectItem); var projectSnapshot = _projectManager.GetLoadedProject(projectPath); if (projectSnapshot != null) { var workspaceProject = _projectManager.Workspace.CurrentSolution?.Projects.FirstOrDefault( project => FilePathComparer.Instance.Equals(project.FilePath, projectSnapshot.FilePath)); if (workspaceProject != null) { // Trigger a tag helper update by forcing the project manager to see the workspace Project // from the current solution. _workspaceStateGenerator.Update(workspaceProject, projectSnapshot); } } }