internal static void EnsureSelectedProjReferencesAreLoadedCommand(IServiceProvider provider, bool unloadUnusedProjects)
        {
            var dte = Package.GetGlobalService(typeof(DTE)) as DTE;

            string[] selectedProjectNames = DteUtil.GetSelectedItemNames(dte);

            IRoslynSolutionAnalysis roslyn = new RoslynSolutionAnalysis();

            var allProjectNamesToLoad = roslyn
                                        .GetRecursivelyReferencedProjects(dte.Solution.FileName, selectedProjectNames)
                                        .Result;

            EnsureProjectsLoadedByNames(dte, allProjectNamesToLoad, unloadUnusedProjects);

            string message = "Ensure only selected projects loaded recurisvely complete";

            // Show a message box to prove we were here
            VsShellUtilities.ShowMessageBox(
                provider,
                message,
                ProjectFocuserCommandPackage.MessageBoxName,
                OLEMSGICON.OLEMSGICON_INFO,
                OLEMSGBUTTON.OLEMSGBUTTON_OK,
                OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST);
        }
示例#2
0
        /// <summary>
        /// Initialization of the package; this method is called right after the package is sited, so this is the place
        /// where you can put all the initialization code that rely on services provided by VisualStudio.
        /// </summary>
        protected override void Initialize()
        {
            RoslynSolutionAnalysis.EnsureMaxVisualStudioMsBuildVersionHasBeenRegistered();

            UnloadAllProjectsCommand.Initialize(this);
            LoadAllProjectsCommand.Initialize(this);
            EnsureOnlySelectedProjReferencesAreLoadedCommand.Initialize(this);
            AddSelectedProjectsAndReferencesCommand.Initialize(this);
            CompileAllInBackgroundCommand.Initialize(this);
            AddProjectsReferencingSelectedCommand.Initialize(this);
            SaveCurrentSuoCommand.Initialize(this);
            RestorePresavedSuoCommand.Initialize(this);
            base.Initialize();
        }