Microsoft.VsSDK.IntegrationTestLibrary.TestUtils.CreateEmptySolution C# (CSharp) Method

CreateEmptySolution() public method

Closes the currently open solution (if any), and creates a new solution with the given name.
public CreateEmptySolution ( string directory, string solutionName ) : void
directory string
solutionName string Name of new solution.
return void
        public void CreateEmptySolution(string directory, string solutionName)
        {
            CloseCurrentSolution(__VSSLNSAVEOPTIONS.SLNSAVEOPT_NoSave);

            string solutionDirectory = GetNewDirectoryName(directory, solutionName);

            // Create and force save solution
            IVsSolution solutionService = (IVsSolution)VsIdeTestHostContext.ServiceProvider.GetService(typeof(IVsSolution));
            solutionService.CreateSolution(solutionDirectory, solutionName, (uint)__VSCREATESOLUTIONFLAGS.CSF_SILENT);
            solutionService.SaveSolutionElement((uint)__VSSLNSAVEOPTIONS.SLNSAVEOPT_ForceSave, null, 0);
            DTE dte = VsIdeTestHostContext.Dte;
            Assert.AreEqual(solutionName + ".sln", Path.GetFileName(dte.Solution.FileName), "Newly created solution has wrong Filename");
        }

Usage Example

示例#1
0
 public void CreateEmptySolution()
 {
     var testUtils = new TestUtils();
     testUtils.CloseCurrentSolution(
             __VSSLNSAVEOPTIONS.SLNSAVEOPT_NoSave );
     testUtils.CreateEmptySolution( TestContext.TestDir, "EmptySolution" );
 }
All Usage Examples Of Microsoft.VsSDK.IntegrationTestLibrary.TestUtils::CreateEmptySolution