protected AbstractIntegrationTest(
            string solutionName,
            string projectTemplate,
            VisualStudioInstanceFactory instanceFactory)
        {
            _visualStudioContext = instanceFactory.GetNewOrUsedInstance(SharedIntegrationHostFixture.RequiredPackageIds);
            VisualStudio         = _visualStudioContext.Instance;

            VisualStudio.SolutionExplorer.CreateSolution(solutionName);
            VisualStudio.SolutionExplorer.AddProject(Project, projectTemplate, DefaultLanguageName);

            // wait for restore to complete.
            VisualStudio.WaitForApplicationIdle();
            VisualStudio.WaitForNoErrorsInErrorList();

            // added to work around https://github.com/dotnet/project-system/issues/2256
            VisualStudio.SolutionExplorer.BuildSolution(waitForBuildToFinish: true);
            var path = VisualStudio.SolutionExplorer.SolutionFileFullPath;

            VisualStudio.SolutionExplorer.CloseSolution();
            VisualStudio.SolutionExplorer.OpenSolution(path);

            VisualStudio.WaitForApplicationIdle();
            VisualStudio.WaitForNoErrorsInErrorList();
        }