private void RenderSolution(string rootPath, Solution s) { using (StreamWriter w = System.IO.File.CreateText(Path.Combine(rootPath, s.Name + ".sln"))) { w.WriteLine("Microsoft Visual Studio Solution File, Format Version " + (s.Version == VsVersion.VS2005 ? "9.00" : (s.Version == VsVersion.VS2008 ? "10.00" : "11.00"))); w.WriteLine("# Visual Studio " + s.Version.ToString().Substring(2)); foreach (Project p in s.Projects) RenderSolutionProject(w, p, s, rootPath); w.WriteLine("Global"); w.WriteLine("GlobalSection(SolutionConfigurationPlatforms) = preSolution"); w.WriteLine("Debug|Any CPU = Debug|Any CPU"); w.WriteLine("Release|.NET = Release|.NET"); w.WriteLine("EndGlobalSection"); w.WriteLine("GlobalSection(ProjectConfigurationPlatforms) = postSolution"); foreach (Project p in s.Projects) RenderSolutionProjectConfiguration(w, p); w.WriteLine("EndGlobalSection"); w.WriteLine("GlobalSection(SolutionProperties) = preSolution"); w.WriteLine("HideSolutionNode = FALSE"); w.WriteLine("EndGlobalSection"); w.WriteLine("EndGlobal"); } }
private void RenderSolutionProject(StreamWriter w, Project p, Solution s, string rootPath) { w.Write("Project(\""); w.Write(p.TypeGuid.ToString("B")); w.Write("\") = \""); w.Write(p.Name); w.Write("\", \""); w.Write(Path.Combine(p.Name, p.GetProjectFileName(s.Version))); w.Write("\", \""); w.Write(p.ProjectGuid.ToString("B")); w.WriteLine("\""); w.WriteLine("ProjectSection(WebsiteProperties) = preProject"); w.WriteLine(@"Debug.AspNetCompiler.Debug = ""True"""); w.WriteLine(@"Release.AspNetCompiler.Release = ""False"""); w.WriteLine("EndProjectSection"); w.WriteLine("EndProject"); }