From c0d69d0ec7c6236294f9b2cf19cebf278b3ddb2d Mon Sep 17 00:00:00 2001 From: lbsa71 Date: Sat, 8 Nov 2008 12:15:28 +0000 Subject: * Rebuildt Prebuild.exe to fix vs2008 not creating Solution * Wrapped solution streamwrites in using for great justice --- Prebuild/src/Core/Targets/VS2005Target.cs | 147 +++++++++++++++--------------- bin/Prebuild.exe | Bin 222720 -> 212992 bytes 2 files changed, 74 insertions(+), 73 deletions(-) diff --git a/Prebuild/src/Core/Targets/VS2005Target.cs b/Prebuild/src/Core/Targets/VS2005Target.cs index 4c17a3a..8e09711 100644 --- a/Prebuild/src/Core/Targets/VS2005Target.cs +++ b/Prebuild/src/Core/Targets/VS2005Target.cs @@ -719,98 +719,99 @@ namespace Prebuild.Core.Targets kernel.Log.Write(""); string solutionFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "sln"); - StreamWriter ss = new StreamWriter(solutionFile); - - kernel.CurrentWorkingDirectory.Push(); - Helper.SetCurrentDir(Path.GetDirectoryName(solutionFile)); - - using (ss) + using (StreamWriter ss = new StreamWriter(solutionFile)) { - ss.WriteLine("Microsoft Visual Studio Solution File, Format Version {0}", this.SolutionVersion); - ss.WriteLine(SolutionTag); - foreach (ProjectNode project in solution.Projects) + kernel.CurrentWorkingDirectory.Push(); + Helper.SetCurrentDir(Path.GetDirectoryName(solutionFile)); + + using (ss) { - if (!tools.ContainsKey(project.Language)) + ss.WriteLine("Microsoft Visual Studio Solution File, Format Version {0}", this.SolutionVersion); + ss.WriteLine(SolutionTag); + foreach (ProjectNode project in solution.Projects) { - throw new UnknownLanguageException("Unknown .NET language: " + project.Language); - } + if (!tools.ContainsKey(project.Language)) + { + throw new UnknownLanguageException("Unknown .NET language: " + project.Language); + } - ToolInfo toolInfo = (ToolInfo)tools[project.Language]; + ToolInfo toolInfo = (ToolInfo)tools[project.Language]; - string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); - ss.WriteLine("Project(\"{0}\") = \"{1}\", \"{2}\", \"{{{3}}}\"", - toolInfo.Guid, project.Name, Helper.MakeFilePath(path, project.Name, - toolInfo.FileExtension), project.Guid.ToString().ToUpper()); + string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); + ss.WriteLine("Project(\"{0}\") = \"{1}\", \"{2}\", \"{{{3}}}\"", + toolInfo.Guid, project.Name, Helper.MakeFilePath(path, project.Name, + toolInfo.FileExtension), project.Guid.ToString().ToUpper()); - //ss.WriteLine(" ProjectSection(ProjectDependencies) = postProject"); - //ss.WriteLine(" EndProjectSection"); + //ss.WriteLine(" ProjectSection(ProjectDependencies) = postProject"); + //ss.WriteLine(" EndProjectSection"); - ss.WriteLine("EndProject"); - } + ss.WriteLine("EndProject"); + } - if (solution.Files != null) - { - ss.WriteLine("Project(\"{0}\") = \"Solution Items\", \"Solution Items\", \"{1}\"", "{2150E333-8FDC-42A3-9474-1A3956D46DE8}", "{468F1D07-AD17-4CC3-ABD0-2CA268E4E1A6}"); - ss.WriteLine("\tProjectSection(SolutionItems) = preProject"); - foreach (string file in solution.Files) - ss.WriteLine("\t\t{0} = {0}", file); - ss.WriteLine("\tEndProjectSection"); - ss.WriteLine("EndProject"); - } + if (solution.Files != null) + { + ss.WriteLine("Project(\"{0}\") = \"Solution Items\", \"Solution Items\", \"{1}\"", "{2150E333-8FDC-42A3-9474-1A3956D46DE8}", "{468F1D07-AD17-4CC3-ABD0-2CA268E4E1A6}"); + ss.WriteLine("\tProjectSection(SolutionItems) = preProject"); + foreach (string file in solution.Files) + ss.WriteLine("\t\t{0} = {0}", file); + ss.WriteLine("\tEndProjectSection"); + ss.WriteLine("EndProject"); + } - ss.WriteLine("Global"); + ss.WriteLine("Global"); - ss.WriteLine(" GlobalSection(SolutionConfigurationPlatforms) = preSolution"); - foreach (ConfigurationNode conf in solution.Configurations) - { - ss.WriteLine(" {0}|Any CPU = {0}|Any CPU", conf.Name); - } - ss.WriteLine(" EndGlobalSection"); + ss.WriteLine(" GlobalSection(SolutionConfigurationPlatforms) = preSolution"); + foreach (ConfigurationNode conf in solution.Configurations) + { + ss.WriteLine(" {0}|Any CPU = {0}|Any CPU", conf.Name); + } + ss.WriteLine(" EndGlobalSection"); - if (solution.Projects.Count > 1) - { - ss.WriteLine(" GlobalSection(ProjectDependencies) = postSolution"); - } - foreach (ProjectNode project in solution.Projects) - { - for (int i = 0; i < project.References.Count; i++) + if (solution.Projects.Count > 1) { - ReferenceNode refr = (ReferenceNode)project.References[i]; - if (solution.ProjectsTable.ContainsKey(refr.Name)) + ss.WriteLine(" GlobalSection(ProjectDependencies) = postSolution"); + } + foreach (ProjectNode project in solution.Projects) + { + for (int i = 0; i < project.References.Count; i++) { - ProjectNode refProject = (ProjectNode)solution.ProjectsTable[refr.Name]; - ss.WriteLine(" ({{{0}}}).{1} = ({{{2}}})", - project.Guid.ToString().ToUpper() - , i, - refProject.Guid.ToString().ToUpper() - ); + ReferenceNode refr = (ReferenceNode)project.References[i]; + if (solution.ProjectsTable.ContainsKey(refr.Name)) + { + ProjectNode refProject = (ProjectNode)solution.ProjectsTable[refr.Name]; + ss.WriteLine(" ({{{0}}}).{1} = ({{{2}}})", + project.Guid.ToString().ToUpper() + , i, + refProject.Guid.ToString().ToUpper() + ); + } } } - } - if (solution.Projects.Count > 1) - { - ss.WriteLine(" EndGlobalSection"); - } - ss.WriteLine(" GlobalSection(ProjectConfigurationPlatforms) = postSolution"); - foreach (ProjectNode project in solution.Projects) - { - foreach (ConfigurationNode conf in solution.Configurations) + if (solution.Projects.Count > 1) { - ss.WriteLine(" {{{0}}}.{1}|Any CPU.ActiveCfg = {1}|Any CPU", - project.Guid.ToString().ToUpper(), - conf.Name); + ss.WriteLine(" EndGlobalSection"); + } + ss.WriteLine(" GlobalSection(ProjectConfigurationPlatforms) = postSolution"); + foreach (ProjectNode project in solution.Projects) + { + foreach (ConfigurationNode conf in solution.Configurations) + { + ss.WriteLine(" {{{0}}}.{1}|Any CPU.ActiveCfg = {1}|Any CPU", + project.Guid.ToString().ToUpper(), + conf.Name); - ss.WriteLine(" {{{0}}}.{1}|Any CPU.Build.0 = {1}|Any CPU", - project.Guid.ToString().ToUpper(), - conf.Name); + ss.WriteLine(" {{{0}}}.{1}|Any CPU.Build.0 = {1}|Any CPU", + project.Guid.ToString().ToUpper(), + conf.Name); + } } - } - ss.WriteLine(" EndGlobalSection"); - ss.WriteLine(" GlobalSection(SolutionProperties) = preSolution"); - ss.WriteLine(" HideSolutionNode = FALSE"); - ss.WriteLine(" EndGlobalSection"); + ss.WriteLine(" EndGlobalSection"); + ss.WriteLine(" GlobalSection(SolutionProperties) = preSolution"); + ss.WriteLine(" HideSolutionNode = FALSE"); + ss.WriteLine(" EndGlobalSection"); - ss.WriteLine("EndGlobal"); + ss.WriteLine("EndGlobal"); + } } kernel.CurrentWorkingDirectory.Pop(); diff --git a/bin/Prebuild.exe b/bin/Prebuild.exe index bbef8ae..cf2949e 100755 Binary files a/bin/Prebuild.exe and b/bin/Prebuild.exe differ -- cgit v1.1