public void MenuItemCallback(object sender, EventArgs e) { if (ShowErrorMessageAndReturnTrueIfNoSolutionOpen()) { return; } var dte = Package.GetGlobalService(typeof(DTE)) as DTE; string[] selectedProjectNames = DteUtil.GetSelectedItemNames(dte); IRoslynSolutionAnalysis roslyn = new RoslynSolutionAnalysis(); var allProjectNamesToLoad = roslyn.GetProjectsDirectlyReferencing(dte.Solution.FileName, selectedProjectNames); DteUtil.EnsureProjectsLoadedByNames(dte, allProjectNamesToLoad, false); string message = "Load projects referencing selected projects directly complete"; // Show a message box to prove we were here VsShellUtilities.ShowMessageBox( this.ServiceProvider, message, ProjectFocuserCommandPackage.MessageBoxName, OLEMSGICON.OLEMSGICON_INFO, OLEMSGBUTTON.OLEMSGBUTTON_OK, OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST); }
public void MenuItemCallback(object sender, EventArgs e) { if (ShowErrorMessageAndReturnTrueIfNoSolutionOpen()) { return; } var componentModel = Package.GetGlobalService(typeof(SComponentModel)) as IComponentModel; var dte = Package.GetGlobalService(typeof(DTE)) as DTE; var slnPath = dte.Solution.FileName; IVsOutputWindowPane customPane = DteUtil.GetThisExtensionOutputPane(); customPane.OutputStringThreadSafe($"Starting full compilation of {slnPath}\r\n"); IRoslynSolutionAnalysis roslyn = new RoslynSolutionAnalysis(); roslyn.CompileFullSolutionInBackgroundAndReportErrors(slnPath, (message) => customPane.OutputStringThreadSafe(message)); }