Exemple #1
0
        private void UseService <T>(FileInfo solutionFile, Action <T> action)
            where T : class
        {
            VisualStudioHost visualStudio = null;

            try
            {
                VisualStudioHostConfiguration configuration = CreateVisualStudioHostConfiguration();

                configuration.AddCompositionAssembly(Assembly.GetExecutingAssembly().Location);

                visualStudio = LaunchVisualStudio(configuration);

                LoadSolution(visualStudio, solutionFile);
                WaitForAutoRestoreToComplete(visualStudio, solutionFile);

                using (Scope.Enter("Get service."))
                {
                    var service = visualStudio.Get <T>();

                    using (Scope.Enter("Verify service."))
                    {
                        action(service);
                    }
                }

                ShutDownVisualStudio(visualStudio);
            }
            catch (Exception ex)
            {
                HandleException(visualStudio, ex);
            }
        }
Exemple #2
0
        protected override VisualStudioHostConfiguration GetVisualStudioHostConfiguration()
        {
            VisualStudioHostConfiguration configuration = base.GetVisualStudioHostConfiguration();

            // start the experimental instance
            configuration.CommandLineArguments += " /RootSuffix Exp";

            return(configuration);
        }
Exemple #3
0
        private VisualStudioHost LaunchVisualStudio(VisualStudioHostConfiguration configuration)
        {
            VisualStudioHost visualStudio = Operations.CreateHost <VisualStudioHost>(configuration);

            using (Scope.Enter("Launch Visual Studio."))
            {
                visualStudio.Start();
            }

            return(visualStudio);
        }
        protected override VisualStudioHostConfiguration GetHostConfiguration()
        {
            var visualStudioHostConfiguration = new VisualStudioHostConfiguration()
            {
                CommandLineArguments             = $"/rootSuffix {_hiveName}",
                RestoreUserSettings              = false,
                InheritProcessEnvironment        = true,
                AutomaticallyDismissMessageBoxes = true,
                DelayInitialVsLicenseValidation  = true,
                ForceFirstLaunch   = true,
                BootstrapInjection = BootstrapInjectionMethod.DteFromROT,
            };

            return(visualStudioHostConfiguration);
        }
Exemple #5
0
        private void OpenSolutionAndBuild(FileInfo solutionFile)
        {
            VisualStudioHost visualStudio = null;

            try
            {
                VisualStudioHostConfiguration configuration = CreateVisualStudioHostConfiguration();

                visualStudio = LaunchVisualStudio(configuration);

                LoadSolution(visualStudio, solutionFile);
                WaitForAutoRestoreToComplete(visualStudio, solutionFile);
                BuildSolution(visualStudio);
                ShutDownVisualStudio(visualStudio);
            }
            catch (Exception ex)
            {
                HandleException(visualStudio, ex);
            }
        }