Beispiel #1
0
        public int UpdateProjectCfg_Done(IVsHierarchy pHierProj, IVsCfg pCfgProj, IVsCfg pCfgSln, uint dwAction, int fSuccess, int fCancel)
        {
            var projectName = _projectService.GetProjectName(pHierProj);
            var projectPath = _projectService.GetProjectPath(pHierProj);

            // Get the corresponding roslyn project by matching the project name and the project path.
            foreach (var project in _projectManager.Workspace.CurrentSolution.Projects)
            {
                if (string.Equals(projectName, project.Name, StringComparison.Ordinal) &&
                    string.Equals(projectPath, project.FilePath, StringComparison.OrdinalIgnoreCase))
                {
                    _projectManager.ProjectBuildComplete(project);
                    break;
                }
            }

            return(VSConstants.S_OK);
        }
Beispiel #2
0
        // 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 projectName = _projectService.GetProjectName(projectItem);
            var projectPath = _projectService.GetProjectPath(projectItem);

            // Get the corresponding roslyn project by matching the project name and the project path.
            foreach (var project in _projectManager.Workspace.CurrentSolution.Projects)
            {
                if (string.Equals(projectName, project.Name, StringComparison.Ordinal) &&
                    string.Equals(projectPath, project.FilePath, StringComparison.OrdinalIgnoreCase))
                {
                    _projectManager.ProjectBuildComplete(project);
                    break;
                }
            }
        }