コード例 #1
0
ファイル: SolutionExtension.cs プロジェクト: xyyhqq/eXpand
        public static Boolean BuildSolution(this Solution solution)
        {
            var dte = DteExtensions.DTE;
            SolutionConfiguration previousSolutionConfiguration = solution.SolutionBuild.ActiveConfiguration;
            var solutionConfiguration = solution.SolutionBuild.SolutionConfigurations.Cast <SolutionConfiguration>().First(configuration => configuration.Name == "EasyTest") ??
                                        solution.SolutionBuild.SolutionConfigurations.Cast <SolutionConfiguration>().First(configuration => configuration.Name == "Debug");

            solutionConfiguration.Activate();
            try {
                dte.WriteToOutput($@"Build the following configuration: ""{dte.Solution.SolutionBuild.ActiveConfiguration.Name}"".");
                dte.ExecuteCommand("Build.BuildSolution");

                while (dte.Solution.SolutionBuild.BuildState != vsBuildState.vsBuildStateDone)
                {
                    Thread.Sleep(100);
                    Application.DoEvents();
                }
            }
            finally {
                if (previousSolutionConfiguration != null)
                {
                    dte.WriteToOutput($@"Restore the previous active configuration: ""{previousSolutionConfiguration.Name}"".");

                    previousSolutionConfiguration.Activate();
                }
            }
            dte.WriteToOutput("Get build result.");
            Boolean isBuildSuccess = dte.Solution.SolutionBuild.LastBuildInfo == 0;

            dte.WriteToOutput(!isBuildSuccess ? "Solution build failed." : "BuildSuccess.");
            return(isBuildSuccess);
        }
コード例 #2
0
 public void RunFinished()
 {
     if (projSolutionContext != null)
     {
         solutionConfig.Activate();
         projSolutionContext.ShouldBuild = true;
         //Force save all?
         dte.ExecuteCommand("File.SaveAll");
     }
 }
コード例 #3
0
 public void Activate()
 {
     _configuration.Activate();
 }