示例#1
0
        /// <summary>
        /// Closes the currently open solution (if any), and creates a new solution with the given name.
        /// </summary>
        /// <param name="solutionName">Name of new solution.</param>
        public static void CreateEmptySolution(IServiceProvider serviceProvider, string destination, string solutionName)
        {
            IVsSolution solutionService = CloseCurrentSolution(serviceProvider);

            // Create solution
            solutionService.CreateSolution(destination, solutionName, (uint)__VSCREATESOLUTIONFLAGS.CSF_SILENT);
            solutionService.SaveSolutionElement((uint)__VSSLNSAVEOPTIONS.SLNSAVEOPT_ForceSave, null, 0);
        }
示例#2
0
        public HResult EnsureSolution()
        {
            ThreadHelper.ThrowIfNotOnUIThread();
            if (IsSolutionOpen())
            {
                return(VSConstants.S_OK);
            }

            return(LogFailed(_vsSolution1.CreateSolution(
                                 lpszLocation: null,
                                 lpszName: null,
                                 grfCreateFlags: (uint)__VSCREATESOLUTIONFLAGS.CSF_TEMPORARY)));
        }
示例#3
0
        /// <summary>
        /// Closes the currently open solution (if any), and creates a new solution with the given name.
        /// </summary>
        /// <param name="solutionName">ProjectName of new solution.</param>
        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");
        }
示例#4
0
 public int CreateSolution(string lpszLocation, string lpszName, uint grfCreateFlags)
 {
     return(_solution.CreateSolution(lpszLocation, lpszName, grfCreateFlags));
 }