diff options
Diffstat (limited to 'Prebuild')
-rw-r--r-- | Prebuild/src/Core/Targets/VS2005Target.cs | 147 |
1 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 | |||
719 | 719 | ||
720 | kernel.Log.Write(""); | 720 | kernel.Log.Write(""); |
721 | string solutionFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "sln"); | 721 | string solutionFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "sln"); |
722 | StreamWriter ss = new StreamWriter(solutionFile); | 722 | using (StreamWriter ss = new StreamWriter(solutionFile)) |
723 | |||
724 | kernel.CurrentWorkingDirectory.Push(); | ||
725 | Helper.SetCurrentDir(Path.GetDirectoryName(solutionFile)); | ||
726 | |||
727 | using (ss) | ||
728 | { | 723 | { |
729 | ss.WriteLine("Microsoft Visual Studio Solution File, Format Version {0}", this.SolutionVersion); | 724 | kernel.CurrentWorkingDirectory.Push(); |
730 | ss.WriteLine(SolutionTag); | 725 | Helper.SetCurrentDir(Path.GetDirectoryName(solutionFile)); |
731 | foreach (ProjectNode project in solution.Projects) | 726 | |
727 | using (ss) | ||
732 | { | 728 | { |
733 | if (!tools.ContainsKey(project.Language)) | 729 | ss.WriteLine("Microsoft Visual Studio Solution File, Format Version {0}", this.SolutionVersion); |
730 | ss.WriteLine(SolutionTag); | ||
731 | foreach (ProjectNode project in solution.Projects) | ||
734 | { | 732 | { |
735 | throw new UnknownLanguageException("Unknown .NET language: " + project.Language); | 733 | if (!tools.ContainsKey(project.Language)) |
736 | } | 734 | { |
735 | throw new UnknownLanguageException("Unknown .NET language: " + project.Language); | ||
736 | } | ||
737 | 737 | ||
738 | ToolInfo toolInfo = (ToolInfo)tools[project.Language]; | 738 | ToolInfo toolInfo = (ToolInfo)tools[project.Language]; |
739 | 739 | ||
740 | string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); | 740 | string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); |
741 | ss.WriteLine("Project(\"{0}\") = \"{1}\", \"{2}\", \"{{{3}}}\"", | 741 | ss.WriteLine("Project(\"{0}\") = \"{1}\", \"{2}\", \"{{{3}}}\"", |
742 | toolInfo.Guid, project.Name, Helper.MakeFilePath(path, project.Name, | 742 | toolInfo.Guid, project.Name, Helper.MakeFilePath(path, project.Name, |
743 | toolInfo.FileExtension), project.Guid.ToString().ToUpper()); | 743 | toolInfo.FileExtension), project.Guid.ToString().ToUpper()); |
744 | 744 | ||
745 | //ss.WriteLine(" ProjectSection(ProjectDependencies) = postProject"); | 745 | //ss.WriteLine(" ProjectSection(ProjectDependencies) = postProject"); |
746 | //ss.WriteLine(" EndProjectSection"); | 746 | //ss.WriteLine(" EndProjectSection"); |
747 | 747 | ||
748 | ss.WriteLine("EndProject"); | 748 | ss.WriteLine("EndProject"); |
749 | } | 749 | } |
750 | 750 | ||
751 | if (solution.Files != null) | 751 | if (solution.Files != null) |
752 | { | 752 | { |
753 | ss.WriteLine("Project(\"{0}\") = \"Solution Items\", \"Solution Items\", \"{1}\"", "{2150E333-8FDC-42A3-9474-1A3956D46DE8}", "{468F1D07-AD17-4CC3-ABD0-2CA268E4E1A6}"); | 753 | ss.WriteLine("Project(\"{0}\") = \"Solution Items\", \"Solution Items\", \"{1}\"", "{2150E333-8FDC-42A3-9474-1A3956D46DE8}", "{468F1D07-AD17-4CC3-ABD0-2CA268E4E1A6}"); |
754 | ss.WriteLine("\tProjectSection(SolutionItems) = preProject"); | 754 | ss.WriteLine("\tProjectSection(SolutionItems) = preProject"); |
755 | foreach (string file in solution.Files) | 755 | foreach (string file in solution.Files) |
756 | ss.WriteLine("\t\t{0} = {0}", file); | 756 | ss.WriteLine("\t\t{0} = {0}", file); |
757 | ss.WriteLine("\tEndProjectSection"); | 757 | ss.WriteLine("\tEndProjectSection"); |
758 | ss.WriteLine("EndProject"); | 758 | ss.WriteLine("EndProject"); |
759 | } | 759 | } |
760 | 760 | ||
761 | ss.WriteLine("Global"); | 761 | ss.WriteLine("Global"); |
762 | 762 | ||
763 | ss.WriteLine(" GlobalSection(SolutionConfigurationPlatforms) = preSolution"); | 763 | ss.WriteLine(" GlobalSection(SolutionConfigurationPlatforms) = preSolution"); |
764 | foreach (ConfigurationNode conf in solution.Configurations) | 764 | foreach (ConfigurationNode conf in solution.Configurations) |
765 | { | 765 | { |
766 | ss.WriteLine(" {0}|Any CPU = {0}|Any CPU", conf.Name); | 766 | ss.WriteLine(" {0}|Any CPU = {0}|Any CPU", conf.Name); |
767 | } | 767 | } |
768 | ss.WriteLine(" EndGlobalSection"); | 768 | ss.WriteLine(" EndGlobalSection"); |
769 | 769 | ||
770 | if (solution.Projects.Count > 1) | 770 | if (solution.Projects.Count > 1) |
771 | { | ||
772 | ss.WriteLine(" GlobalSection(ProjectDependencies) = postSolution"); | ||
773 | } | ||
774 | foreach (ProjectNode project in solution.Projects) | ||
775 | { | ||
776 | for (int i = 0; i < project.References.Count; i++) | ||
777 | { | 771 | { |
778 | ReferenceNode refr = (ReferenceNode)project.References[i]; | 772 | ss.WriteLine(" GlobalSection(ProjectDependencies) = postSolution"); |
779 | if (solution.ProjectsTable.ContainsKey(refr.Name)) | 773 | } |
774 | foreach (ProjectNode project in solution.Projects) | ||
775 | { | ||
776 | for (int i = 0; i < project.References.Count; i++) | ||
780 | { | 777 | { |
781 | ProjectNode refProject = (ProjectNode)solution.ProjectsTable[refr.Name]; | 778 | ReferenceNode refr = (ReferenceNode)project.References[i]; |
782 | ss.WriteLine(" ({{{0}}}).{1} = ({{{2}}})", | 779 | if (solution.ProjectsTable.ContainsKey(refr.Name)) |
783 | project.Guid.ToString().ToUpper() | 780 | { |
784 | , i, | 781 | ProjectNode refProject = (ProjectNode)solution.ProjectsTable[refr.Name]; |
785 | refProject.Guid.ToString().ToUpper() | 782 | ss.WriteLine(" ({{{0}}}).{1} = ({{{2}}})", |
786 | ); | 783 | project.Guid.ToString().ToUpper() |
784 | , i, | ||
785 | refProject.Guid.ToString().ToUpper() | ||
786 | ); | ||
787 | } | ||
787 | } | 788 | } |
788 | } | 789 | } |
789 | } | 790 | if (solution.Projects.Count > 1) |
790 | if (solution.Projects.Count > 1) | ||
791 | { | ||
792 | ss.WriteLine(" EndGlobalSection"); | ||
793 | } | ||
794 | ss.WriteLine(" GlobalSection(ProjectConfigurationPlatforms) = postSolution"); | ||
795 | foreach (ProjectNode project in solution.Projects) | ||
796 | { | ||
797 | foreach (ConfigurationNode conf in solution.Configurations) | ||
798 | { | 791 | { |
799 | ss.WriteLine(" {{{0}}}.{1}|Any CPU.ActiveCfg = {1}|Any CPU", | 792 | ss.WriteLine(" EndGlobalSection"); |
800 | project.Guid.ToString().ToUpper(), | 793 | } |
801 | conf.Name); | 794 | ss.WriteLine(" GlobalSection(ProjectConfigurationPlatforms) = postSolution"); |
795 | foreach (ProjectNode project in solution.Projects) | ||
796 | { | ||
797 | foreach (ConfigurationNode conf in solution.Configurations) | ||
798 | { | ||
799 | ss.WriteLine(" {{{0}}}.{1}|Any CPU.ActiveCfg = {1}|Any CPU", | ||
800 | project.Guid.ToString().ToUpper(), | ||
801 | conf.Name); | ||
802 | 802 | ||
803 | ss.WriteLine(" {{{0}}}.{1}|Any CPU.Build.0 = {1}|Any CPU", | 803 | ss.WriteLine(" {{{0}}}.{1}|Any CPU.Build.0 = {1}|Any CPU", |
804 | project.Guid.ToString().ToUpper(), | 804 | project.Guid.ToString().ToUpper(), |
805 | conf.Name); | 805 | conf.Name); |
806 | } | ||
806 | } | 807 | } |
807 | } | 808 | ss.WriteLine(" EndGlobalSection"); |
808 | ss.WriteLine(" EndGlobalSection"); | 809 | ss.WriteLine(" GlobalSection(SolutionProperties) = preSolution"); |
809 | ss.WriteLine(" GlobalSection(SolutionProperties) = preSolution"); | 810 | ss.WriteLine(" HideSolutionNode = FALSE"); |
810 | ss.WriteLine(" HideSolutionNode = FALSE"); | 811 | ss.WriteLine(" EndGlobalSection"); |
811 | ss.WriteLine(" EndGlobalSection"); | ||
812 | 812 | ||
813 | ss.WriteLine("EndGlobal"); | 813 | ss.WriteLine("EndGlobal"); |
814 | } | ||
814 | } | 815 | } |
815 | 816 | ||
816 | kernel.CurrentWorkingDirectory.Pop(); | 817 | kernel.CurrentWorkingDirectory.Pop(); |