aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Prebuild/src/Core/Targets
diff options
context:
space:
mode:
Diffstat (limited to 'Prebuild/src/Core/Targets')
-rw-r--r--Prebuild/src/Core/Targets/AutotoolsTarget.cs14
-rw-r--r--Prebuild/src/Core/Targets/DebugTarget.cs110
-rw-r--r--Prebuild/src/Core/Targets/MakefileTarget.cs20
-rw-r--r--Prebuild/src/Core/Targets/MonoDevelopTarget.cs964
-rw-r--r--Prebuild/src/Core/Targets/NAntTarget.cs771
-rw-r--r--Prebuild/src/Core/Targets/SharpDevelop2Target.cs88
-rw-r--r--Prebuild/src/Core/Targets/SharpDevelopTarget.cs794
-rw-r--r--Prebuild/src/Core/Targets/ToolInfo.cs356
-rw-r--r--Prebuild/src/Core/Targets/VS2002Target.cs114
-rw-r--r--Prebuild/src/Core/Targets/VS2003Target.cs1132
-rw-r--r--Prebuild/src/Core/Targets/VS2005Target.cs26
-rw-r--r--Prebuild/src/Core/Targets/VS2008Target.cs180
-rw-r--r--Prebuild/src/Core/Targets/VS2010Target.cs204
-rw-r--r--Prebuild/src/Core/Targets/VSGenericTarget.cs1766
-rw-r--r--Prebuild/src/Core/Targets/VSVersion.cs79
-rw-r--r--Prebuild/src/Core/Targets/XcodeTarget.cs24
16 files changed, 3343 insertions, 3299 deletions
diff --git a/Prebuild/src/Core/Targets/AutotoolsTarget.cs b/Prebuild/src/Core/Targets/AutotoolsTarget.cs
index c52c4f1..485e4dd 100644
--- a/Prebuild/src/Core/Targets/AutotoolsTarget.cs
+++ b/Prebuild/src/Core/Targets/AutotoolsTarget.cs
@@ -51,10 +51,10 @@ POSSIBILITY OF SUCH DAMAGE.
51 distribute, sublicense, and/or sell copies of the Software, and to 51 distribute, sublicense, and/or sell copies of the Software, and to
52 permit persons to whom the Software is furnished to do so, subject to 52 permit persons to whom the Software is furnished to do so, subject to
53 the following conditions: 53 the following conditions:
54 54
55 The above copyright notice and this permission notice shall be 55 The above copyright notice and this permission notice shall be
56 included in all copies or substantial portions of the Software. 56 included in all copies or substantial portions of the Software.
57 57
58 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 58 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
59 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 59 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
60 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 60 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
@@ -156,7 +156,7 @@ namespace Prebuild.Core.Targets
156 156
157 157
158 /// <summary> 158 /// <summary>
159 /// 159 ///
160 /// </summary> 160 /// </summary>
161 [Target("autotools")] 161 [Target("autotools")]
162 public class AutotoolsTarget : ITarget 162 public class AutotoolsTarget : ITarget
@@ -650,7 +650,7 @@ namespace Prebuild.Core.Targets
650 string tempAssemblyFile = Path.Combine(Path.GetTempPath(), project.Name + "-temp.dll"); 650 string tempAssemblyFile = Path.Combine(Path.GetTempPath(), project.Name + "-temp.dll");
651 System.CodeDom.Compiler.CompilerParameters cparam = 651 System.CodeDom.Compiler.CompilerParameters cparam =
652 new System.CodeDom.Compiler.CompilerParameters(args, tempAssemblyFile); 652 new System.CodeDom.Compiler.CompilerParameters(args, tempAssemblyFile);
653 653
654 System.CodeDom.Compiler.CompilerResults cr = 654 System.CodeDom.Compiler.CompilerResults cr =
655 cscp.CompileAssemblyFromFile(cparam, sources); 655 cscp.CompileAssemblyFromFile(cparam, sources);
656 656
@@ -673,11 +673,11 @@ namespace Prebuild.Core.Targets
673 if (File.Exists(tempAssemblyFile)) 673 if (File.Exists(tempAssemblyFile))
674 File.Delete(tempAssemblyFile); 674 File.Delete(tempAssemblyFile);
675 } 675 }
676 catch 676 catch
677 { 677 {
678 Console.WriteLine("Error! '{0}'", e); 678 Console.WriteLine("Error! '{0}'", e);
679 } 679 }
680 680
681 } 681 }
682 682
683 // Tell the user if there's a problem copying the file 683 // Tell the user if there's a problem copying the file
@@ -977,7 +977,7 @@ namespace Prebuild.Core.Targets
977 977
978 if(autotoolsStream == null) { 978 if(autotoolsStream == null) {
979 979
980 /* 980 /*
981 * try without the default namespace prepended, in 981 * try without the default namespace prepended, in
982 * case prebuild.exe assembly was compiled with 982 * case prebuild.exe assembly was compiled with
983 * something other than Visual Studio .NET 983 * something other than Visual Studio .NET
diff --git a/Prebuild/src/Core/Targets/DebugTarget.cs b/Prebuild/src/Core/Targets/DebugTarget.cs
index be8aea9..d78064f 100644
--- a/Prebuild/src/Core/Targets/DebugTarget.cs
+++ b/Prebuild/src/Core/Targets/DebugTarget.cs
@@ -5,16 +5,16 @@ Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehea
5Redistribution and use in source and binary forms, with or without modification, are permitted 5Redistribution and use in source and binary forms, with or without modification, are permitted
6provided that the following conditions are met: 6provided that the following conditions are met:
7 7
8* Redistributions of source code must retain the above copyright notice, this list of conditions 8* Redistributions of source code must retain the above copyright notice, this list of conditions
9 and the following disclaimer. 9 and the following disclaimer.
10* Redistributions in binary form must reproduce the above copyright notice, this list of conditions 10* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
11 and the following disclaimer in the documentation and/or other materials provided with the 11 and the following disclaimer in the documentation and/or other materials provided with the
12 distribution. 12 distribution.
13* The name of the author may not be used to endorse or promote products derived from this software 13* The name of the author may not be used to endorse or promote products derived from this software
14 without specific prior written permission. 14 without specific prior written permission.
15 15
16THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, 16THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
17BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 18ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 19EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 20OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
@@ -41,62 +41,62 @@ using Prebuild.Core.Nodes;
41#if (DEBUG && _DEBUG_TARGET) 41#if (DEBUG && _DEBUG_TARGET)
42namespace Prebuild.Core.Targets 42namespace Prebuild.Core.Targets
43{ 43{
44 [Target("debug")] 44 [Target("debug")]
45 public class DebugTarget : ITarget 45 public class DebugTarget : ITarget
46 { 46 {
47#region Fields 47#region Fields
48 48
49 private Kernel m_Kernel = null; 49 private Kernel m_Kernel = null;
50 50
51#endregion 51#endregion
52 52
53#region ITarget Members 53#region ITarget Members
54 54
55 public void Write() 55 public void Write()
56 { 56 {
57 foreach(SolutionNode s in m_Kernel.Solutions) 57 foreach(SolutionNode s in m_Kernel.Solutions)
58 { 58 {
59 Console.WriteLine("Solution [ {0}, {1} ]", s.Name, s.Path); 59 Console.WriteLine("Solution [ {0}, {1} ]", s.Name, s.Path);
60 foreach(string file in s.Files) 60 foreach(string file in s.Files)
61{ 61{
62 Console.WriteLine("\tFile [ {0} ]", file); 62 Console.WriteLine("\tFile [ {0} ]", file);
63} 63}
64 64
65 foreach(ProjectNode proj in s.Projects) 65 foreach(ProjectNode proj in s.Projects)
66 { 66 {
67 Console.WriteLine("\tProject [ {0}, {1}. {2} ]", proj.Name, proj.Path, proj.Language); 67 Console.WriteLine("\tProject [ {0}, {1}. {2} ]", proj.Name, proj.Path, proj.Language);
68 foreach(string file in proj.Files) 68 foreach(string file in proj.Files)
69 Console.WriteLine("\t\tFile [ {0} ]", file); 69 Console.WriteLine("\t\tFile [ {0} ]", file);
70 } 70 }
71 } 71 }
72 } 72 }
73 73
74 public void Clean() 74 public void Clean()
75 { 75 {
76 Console.WriteLine("Not implemented"); 76 Console.WriteLine("Not implemented");
77 } 77 }
78 78
79 public string Name 79 public string Name
80 { 80 {
81 get 81 get
82 { 82 {
83 return "debug"; 83 return "debug";
84 } 84 }
85 } 85 }
86 86
87 public Kernel Kernel 87 public Kernel Kernel
88 { 88 {
89 get 89 get
90 { 90 {
91 return m_Kernel; 91 return m_Kernel;
92 } 92 }
93 set 93 set
94 { 94 {
95 m_Kernel = value; 95 m_Kernel = value;
96 } 96 }
97 } 97 }
98 98
99#endregion 99#endregion
100 } 100 }
101} 101}
102#endif 102#endif
diff --git a/Prebuild/src/Core/Targets/MakefileTarget.cs b/Prebuild/src/Core/Targets/MakefileTarget.cs
index 8fe1c44..54046dd 100644
--- a/Prebuild/src/Core/Targets/MakefileTarget.cs
+++ b/Prebuild/src/Core/Targets/MakefileTarget.cs
@@ -5,16 +5,16 @@ Copyright (c) 2004 Crestez Leonard (cleonard@go.ro)
5Redistribution and use in source and binary forms, with or without modification, are permitted 5Redistribution and use in source and binary forms, with or without modification, are permitted
6provided that the following conditions are met: 6provided that the following conditions are met:
7 7
8* Redistributions of source code must retain the above copyright notice, this list of conditions 8* Redistributions of source code must retain the above copyright notice, this list of conditions
9 and the following disclaimer. 9 and the following disclaimer.
10* Redistributions in binary form must reproduce the above copyright notice, this list of conditions 10* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
11 and the following disclaimer in the documentation and/or other materials provided with the 11 and the following disclaimer in the documentation and/or other materials provided with the
12 distribution. 12 distribution.
13* The name of the author may not be used to endorse or promote products derived from this software 13* The name of the author may not be used to endorse or promote products derived from this software
14 without specific prior written permission. 14 without specific prior written permission.
15 15
16THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, 16THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
17BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 18ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 19EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 20OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
diff --git a/Prebuild/src/Core/Targets/MonoDevelopTarget.cs b/Prebuild/src/Core/Targets/MonoDevelopTarget.cs
index 85fe2db..ea6d2c2 100644
--- a/Prebuild/src/Core/Targets/MonoDevelopTarget.cs
+++ b/Prebuild/src/Core/Targets/MonoDevelopTarget.cs
@@ -5,16 +5,16 @@ Copyright (c) 2004 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (da
5Redistribution and use in source and binary forms, with or without modification, are permitted 5Redistribution and use in source and binary forms, with or without modification, are permitted
6provided that the following conditions are met: 6provided that the following conditions are met:
7 7
8* Redistributions of source code must retain the above copyright notice, this list of conditions 8* Redistributions of source code must retain the above copyright notice, this list of conditions
9 and the following disclaimer. 9 and the following disclaimer.
10* Redistributions in binary form must reproduce the above copyright notice, this list of conditions 10* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
11 and the following disclaimer in the documentation and/or other materials provided with the 11 and the following disclaimer in the documentation and/or other materials provided with the
12 distribution. 12 distribution.
13* The name of the author may not be used to endorse or promote products derived from this software 13* The name of the author may not be used to endorse or promote products derived from this software
14 without specific prior written permission. 14 without specific prior written permission.
15 15
16THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, 16THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
17BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 18ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 19EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 20OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
@@ -35,481 +35,481 @@ using Prebuild.Core.Utilities;
35 35
36namespace Prebuild.Core.Targets 36namespace Prebuild.Core.Targets
37{ 37{
38 /// <summary> 38 /// <summary>
39 /// 39 ///
40 /// </summary> 40 /// </summary>
41 [Target("monodev")] 41 [Target("monodev")]
42 public class MonoDevelopTarget : ITarget 42 public class MonoDevelopTarget : ITarget
43 { 43 {
44 #region Fields 44 #region Fields
45 45
46 private Kernel m_Kernel; 46 private Kernel m_Kernel;
47 47
48 #endregion 48 #endregion
49 49
50 #region Private Methods 50 #region Private Methods
51 51
52 private static string PrependPath(string path) 52 private static string PrependPath(string path)
53 { 53 {
54 string tmpPath = Helper.NormalizePath(path, '/'); 54 string tmpPath = Helper.NormalizePath(path, '/');
55 Regex regex = new Regex(@"(\w):/(\w+)"); 55 Regex regex = new Regex(@"(\w):/(\w+)");
56 Match match = regex.Match(tmpPath); 56 Match match = regex.Match(tmpPath);
57 if(match.Success || tmpPath[0] == '.' || tmpPath[0] == '/') 57 if(match.Success || tmpPath[0] == '.' || tmpPath[0] == '/')
58 { 58 {
59 tmpPath = Helper.NormalizePath(tmpPath); 59 tmpPath = Helper.NormalizePath(tmpPath);
60 } 60 }
61 else 61 else
62 { 62 {
63 tmpPath = Helper.NormalizePath("./" + tmpPath); 63 tmpPath = Helper.NormalizePath("./" + tmpPath);
64 } 64 }
65 65
66 return tmpPath; 66 return tmpPath;
67 } 67 }
68 68
69 private static string BuildReference(SolutionNode solution, ReferenceNode refr) 69 private static string BuildReference(SolutionNode solution, ReferenceNode refr)
70 { 70 {
71 string ret = "<ProjectReference type=\""; 71 string ret = "<ProjectReference type=\"";
72 if(solution.ProjectsTable.ContainsKey(refr.Name)) 72 if(solution.ProjectsTable.ContainsKey(refr.Name))
73 { 73 {
74 ret += "Project\""; 74 ret += "Project\"";
75 ret += " localcopy=\"" + refr.LocalCopy.ToString() + "\" refto=\"" + refr.Name + "\" />"; 75 ret += " localcopy=\"" + refr.LocalCopy.ToString() + "\" refto=\"" + refr.Name + "\" />";
76 } 76 }
77 else 77 else
78 { 78 {
79 ProjectNode project = (ProjectNode)refr.Parent; 79 ProjectNode project = (ProjectNode)refr.Parent;
80 string fileRef = FindFileReference(refr.Name, project); 80 string fileRef = FindFileReference(refr.Name, project);
81 81
82 if(refr.Path != null || fileRef != null) 82 if(refr.Path != null || fileRef != null)
83 { 83 {
84 ret += "Assembly\" refto=\""; 84 ret += "Assembly\" refto=\"";
85 85
86 string finalPath = (refr.Path != null) ? Helper.MakeFilePath(refr.Path, refr.Name, "dll") : fileRef; 86 string finalPath = (refr.Path != null) ? Helper.MakeFilePath(refr.Path, refr.Name, "dll") : fileRef;
87 87
88 ret += finalPath; 88 ret += finalPath;
89 ret += "\" localcopy=\"" + refr.LocalCopy.ToString() + "\" />"; 89 ret += "\" localcopy=\"" + refr.LocalCopy.ToString() + "\" />";
90 return ret; 90 return ret;
91 } 91 }
92 92
93 ret += "Gac\""; 93 ret += "Gac\"";
94 ret += " localcopy=\"" + refr.LocalCopy.ToString() + "\""; 94 ret += " localcopy=\"" + refr.LocalCopy.ToString() + "\"";
95 ret += " refto=\""; 95 ret += " refto=\"";
96 try 96 try
97 { 97 {
98 /* 98 /*
99 Day changed to 28 Mar 2007 99 Day changed to 28 Mar 2007
100 ... 100 ...
101 08:09 < cj> is there anything that replaces Assembly.LoadFromPartialName() ? 101 08:09 < cj> is there anything that replaces Assembly.LoadFromPartialName() ?
102 08:09 < jonp> no 102 08:09 < jonp> no
103 08:10 < jonp> in their infinite wisdom [sic], microsoft decided that the 103 08:10 < jonp> in their infinite wisdom [sic], microsoft decided that the
104 ability to load any assembly version by-name was an inherently 104 ability to load any assembly version by-name was an inherently
105 bad idea 105 bad idea
106 08:11 < cj> I'm thinking of a bunch of four-letter words right now... 106 08:11 < cj> I'm thinking of a bunch of four-letter words right now...
107 08:11 < cj> security through making it difficult for the developer!!! 107 08:11 < cj> security through making it difficult for the developer!!!
108 08:12 < jonp> just use the Obsolete API 108 08:12 < jonp> just use the Obsolete API
109 08:12 < jonp> it should still work 109 08:12 < jonp> it should still work
110 08:12 < cj> alrighty. 110 08:12 < cj> alrighty.
111 08:12 < jonp> you just get warnings when using it 111 08:12 < jonp> you just get warnings when using it
112 */ 112 */
113 Assembly assem = Assembly.LoadWithPartialName(refr.Name); 113 Assembly assem = Assembly.LoadWithPartialName(refr.Name);
114 ret += assem.FullName; 114 ret += assem.FullName;
115 //ret += refr.Name; 115 //ret += refr.Name;
116 } 116 }
117 catch (System.NullReferenceException e) 117 catch (System.NullReferenceException e)
118 { 118 {
119 e.ToString(); 119 e.ToString();
120 ret += refr.Name; 120 ret += refr.Name;
121 } 121 }
122 ret += "\" />"; 122 ret += "\" />";
123 } 123 }
124 124
125 return ret; 125 return ret;
126 } 126 }
127 127
128 private static string FindFileReference(string refName, ProjectNode project) 128 private static string FindFileReference(string refName, ProjectNode project)
129 { 129 {
130 foreach(ReferencePathNode refPath in project.ReferencePaths) 130 foreach(ReferencePathNode refPath in project.ReferencePaths)
131 { 131 {
132 string fullPath = Helper.MakeFilePath(refPath.Path, refName, "dll"); 132 string fullPath = Helper.MakeFilePath(refPath.Path, refName, "dll");
133 133
134 if(File.Exists(fullPath)) 134 if(File.Exists(fullPath))
135 { 135 {
136 return fullPath; 136 return fullPath;
137 } 137 }
138 } 138 }
139 139
140 return null; 140 return null;
141 } 141 }
142 142
143 /// <summary> 143 /// <summary>
144 /// Gets the XML doc file. 144 /// Gets the XML doc file.
145 /// </summary> 145 /// </summary>
146 /// <param name="project">The project.</param> 146 /// <param name="project">The project.</param>
147 /// <param name="conf">The conf.</param> 147 /// <param name="conf">The conf.</param>
148 /// <returns></returns> 148 /// <returns></returns>
149 public static string GenerateXmlDocFile(ProjectNode project, ConfigurationNode conf) 149 public static string GenerateXmlDocFile(ProjectNode project, ConfigurationNode conf)
150 { 150 {
151 if( conf == null ) 151 if( conf == null )
152 { 152 {
153 throw new ArgumentNullException("conf"); 153 throw new ArgumentNullException("conf");
154 } 154 }
155 if( project == null ) 155 if( project == null )
156 { 156 {
157 throw new ArgumentNullException("project"); 157 throw new ArgumentNullException("project");
158 } 158 }
159 string docFile = (string)conf.Options["XmlDocFile"]; 159 string docFile = (string)conf.Options["XmlDocFile"];
160 if(docFile != null && docFile.Length == 0)//default to assembly name if not specified 160 if(docFile != null && docFile.Length == 0)//default to assembly name if not specified
161 { 161 {
162 return "False"; 162 return "False";
163 } 163 }
164 return "True"; 164 return "True";
165 } 165 }
166 166
167 private void WriteProject(SolutionNode solution, ProjectNode project) 167 private void WriteProject(SolutionNode solution, ProjectNode project)
168 { 168 {
169 string csComp = "Mcs"; 169 string csComp = "Mcs";
170 string netRuntime = "Mono"; 170 string netRuntime = "Mono";
171 if(project.Runtime == ClrRuntime.Microsoft) 171 if(project.Runtime == ClrRuntime.Microsoft)
172 { 172 {
173 csComp = "Csc"; 173 csComp = "Csc";
174 netRuntime = "MsNet"; 174 netRuntime = "MsNet";
175 } 175 }
176 176
177 string projFile = Helper.MakeFilePath(project.FullPath, project.Name, "mdp"); 177 string projFile = Helper.MakeFilePath(project.FullPath, project.Name, "mdp");
178 StreamWriter ss = new StreamWriter(projFile); 178 StreamWriter ss = new StreamWriter(projFile);
179 179
180 m_Kernel.CurrentWorkingDirectory.Push(); 180 m_Kernel.CurrentWorkingDirectory.Push();
181 Helper.SetCurrentDir(Path.GetDirectoryName(projFile)); 181 Helper.SetCurrentDir(Path.GetDirectoryName(projFile));
182 182
183 using(ss) 183 using(ss)
184 { 184 {
185 ss.WriteLine( 185 ss.WriteLine(
186 "<Project name=\"{0}\" description=\"\" standardNamespace=\"{1}\" newfilesearch=\"None\" enableviewstate=\"True\" fileversion=\"2.0\" language=\"C#\" clr-version=\"Net_2_0\" ctype=\"DotNetProject\">", 186 "<Project name=\"{0}\" description=\"\" standardNamespace=\"{1}\" newfilesearch=\"None\" enableviewstate=\"True\" fileversion=\"2.0\" language=\"C#\" clr-version=\"Net_2_0\" ctype=\"DotNetProject\">",
187 project.Name, 187 project.Name,
188 project.RootNamespace 188 project.RootNamespace
189 ); 189 );
190 190
191 int count = 0; 191 int count = 0;
192 192
193 ss.WriteLine(" <Configurations active=\"{0}\">", solution.ActiveConfig); 193 ss.WriteLine(" <Configurations active=\"{0}\">", solution.ActiveConfig);
194 194
195 foreach(ConfigurationNode conf in project.Configurations) 195 foreach(ConfigurationNode conf in project.Configurations)
196 { 196 {
197 ss.WriteLine(" <Configuration name=\"{0}\" ctype=\"DotNetProjectConfiguration\">", conf.Name); 197 ss.WriteLine(" <Configuration name=\"{0}\" ctype=\"DotNetProjectConfiguration\">", conf.Name);
198 ss.Write(" <Output"); 198 ss.Write(" <Output");
199 ss.Write(" directory=\"{0}\"", Helper.EndPath(Helper.NormalizePath(".\\" + conf.Options["OutputPath"].ToString()))); 199 ss.Write(" directory=\"{0}\"", Helper.EndPath(Helper.NormalizePath(".\\" + conf.Options["OutputPath"].ToString())));
200 ss.Write(" assembly=\"{0}\"", project.AssemblyName); 200 ss.Write(" assembly=\"{0}\"", project.AssemblyName);
201 ss.Write(" executeScript=\"{0}\"", conf.Options["RunScript"]); 201 ss.Write(" executeScript=\"{0}\"", conf.Options["RunScript"]);
202 //ss.Write(" executeBeforeBuild=\"{0}\"", conf.Options["PreBuildEvent"]); 202 //ss.Write(" executeBeforeBuild=\"{0}\"", conf.Options["PreBuildEvent"]);
203 //ss.Write(" executeAfterBuild=\"{0}\"", conf.Options["PostBuildEvent"]); 203 //ss.Write(" executeAfterBuild=\"{0}\"", conf.Options["PostBuildEvent"]);
204 if (conf.Options["PreBuildEvent"] != null && conf.Options["PreBuildEvent"].ToString().Length != 0) 204 if (conf.Options["PreBuildEvent"] != null && conf.Options["PreBuildEvent"].ToString().Length != 0)
205 { 205 {
206 ss.Write(" executeBeforeBuild=\"{0}\"", Helper.NormalizePath(conf.Options["PreBuildEvent"].ToString())); 206 ss.Write(" executeBeforeBuild=\"{0}\"", Helper.NormalizePath(conf.Options["PreBuildEvent"].ToString()));
207 } 207 }
208 else 208 else
209 { 209 {
210 ss.Write(" executeBeforeBuild=\"{0}\"", conf.Options["PreBuildEvent"]); 210 ss.Write(" executeBeforeBuild=\"{0}\"", conf.Options["PreBuildEvent"]);
211 } 211 }
212 if (conf.Options["PostBuildEvent"] != null && conf.Options["PostBuildEvent"].ToString().Length != 0) 212 if (conf.Options["PostBuildEvent"] != null && conf.Options["PostBuildEvent"].ToString().Length != 0)
213 { 213 {
214 ss.Write(" executeAfterBuild=\"{0}\"", Helper.NormalizePath(conf.Options["PostBuildEvent"].ToString())); 214 ss.Write(" executeAfterBuild=\"{0}\"", Helper.NormalizePath(conf.Options["PostBuildEvent"].ToString()));
215 } 215 }
216 else 216 else
217 { 217 {
218 ss.Write(" executeAfterBuild=\"{0}\"", conf.Options["PostBuildEvent"]); 218 ss.Write(" executeAfterBuild=\"{0}\"", conf.Options["PostBuildEvent"]);
219 } 219 }
220 ss.Write(" executeBeforeBuildArguments=\"{0}\"", conf.Options["PreBuildEventArgs"]); 220 ss.Write(" executeBeforeBuildArguments=\"{0}\"", conf.Options["PreBuildEventArgs"]);
221 ss.Write(" executeAfterBuildArguments=\"{0}\"", conf.Options["PreBuildEventArgs"]); 221 ss.Write(" executeAfterBuildArguments=\"{0}\"", conf.Options["PreBuildEventArgs"]);
222 ss.WriteLine(" />"); 222 ss.WriteLine(" />");
223 223
224 ss.Write(" <Build"); 224 ss.Write(" <Build");
225 ss.Write(" debugmode=\"True\""); 225 ss.Write(" debugmode=\"True\"");
226 if (project.Type == ProjectType.WinExe) 226 if (project.Type == ProjectType.WinExe)
227 { 227 {
228 ss.Write(" target=\"{0}\"", ProjectType.Exe.ToString()); 228 ss.Write(" target=\"{0}\"", ProjectType.Exe.ToString());
229 } 229 }
230 else 230 else
231 { 231 {
232 ss.Write(" target=\"{0}\"", project.Type); 232 ss.Write(" target=\"{0}\"", project.Type);
233 } 233 }
234 ss.WriteLine(" />"); 234 ss.WriteLine(" />");
235 235
236 ss.Write(" <Execution"); 236 ss.Write(" <Execution");
237 ss.Write(" runwithwarnings=\"{0}\"", !conf.Options.WarningsAsErrors); 237 ss.Write(" runwithwarnings=\"{0}\"", !conf.Options.WarningsAsErrors);
238 ss.Write(" consolepause=\"True\""); 238 ss.Write(" consolepause=\"True\"");
239 ss.Write(" runtime=\"{0}\"", netRuntime); 239 ss.Write(" runtime=\"{0}\"", netRuntime);
240 ss.Write(" clr-version=\"Net_2_0\""); 240 ss.Write(" clr-version=\"Net_2_0\"");
241 ss.WriteLine(" />"); 241 ss.WriteLine(" />");
242 242
243 ss.Write(" <CodeGeneration"); 243 ss.Write(" <CodeGeneration");
244 ss.Write(" compiler=\"{0}\"", csComp); 244 ss.Write(" compiler=\"{0}\"", csComp);
245 ss.Write(" warninglevel=\"{0}\"", conf.Options["WarningLevel"]); 245 ss.Write(" warninglevel=\"{0}\"", conf.Options["WarningLevel"]);
246 ss.Write(" nowarn=\"{0}\"", conf.Options["SuppressWarnings"]); 246 ss.Write(" nowarn=\"{0}\"", conf.Options["SuppressWarnings"]);
247 ss.Write(" includedebuginformation=\"{0}\"", conf.Options["DebugInformation"]); 247 ss.Write(" includedebuginformation=\"{0}\"", conf.Options["DebugInformation"]);
248 ss.Write(" optimize=\"{0}\"", conf.Options["OptimizeCode"]); 248 ss.Write(" optimize=\"{0}\"", conf.Options["OptimizeCode"]);
249 ss.Write(" unsafecodeallowed=\"{0}\"", conf.Options["AllowUnsafe"]); 249 ss.Write(" unsafecodeallowed=\"{0}\"", conf.Options["AllowUnsafe"]);
250 ss.Write(" generateoverflowchecks=\"{0}\"", conf.Options["CheckUnderflowOverflow"]); 250 ss.Write(" generateoverflowchecks=\"{0}\"", conf.Options["CheckUnderflowOverflow"]);
251 ss.Write(" mainclass=\"{0}\"", project.StartupObject); 251 ss.Write(" mainclass=\"{0}\"", project.StartupObject);
252 ss.Write(" target=\"{0}\"", project.Type); 252 ss.Write(" target=\"{0}\"", project.Type);
253 ss.Write(" definesymbols=\"{0}\"", conf.Options["CompilerDefines"]); 253 ss.Write(" definesymbols=\"{0}\"", conf.Options["CompilerDefines"]);
254 ss.Write(" generatexmldocumentation=\"{0}\"", GenerateXmlDocFile(project, conf)); 254 ss.Write(" generatexmldocumentation=\"{0}\"", GenerateXmlDocFile(project, conf));
255 ss.Write(" win32Icon=\"{0}\"", project.AppIcon); 255 ss.Write(" win32Icon=\"{0}\"", project.AppIcon);
256 ss.Write(" ctype=\"CSharpCompilerParameters\""); 256 ss.Write(" ctype=\"CSharpCompilerParameters\"");
257 ss.WriteLine(" />"); 257 ss.WriteLine(" />");
258 ss.WriteLine(" </Configuration>"); 258 ss.WriteLine(" </Configuration>");
259 259
260 count++; 260 count++;
261 } 261 }
262 ss.WriteLine(" </Configurations>"); 262 ss.WriteLine(" </Configurations>");
263 263
264 ss.Write(" <DeploymentInformation"); 264 ss.Write(" <DeploymentInformation");
265 ss.Write(" target=\"\""); 265 ss.Write(" target=\"\"");
266 ss.Write(" script=\"\""); 266 ss.Write(" script=\"\"");
267 ss.Write(" strategy=\"File\""); 267 ss.Write(" strategy=\"File\"");
268 ss.WriteLine(">"); 268 ss.WriteLine(">");
269 ss.WriteLine(" <excludeFiles />"); 269 ss.WriteLine(" <excludeFiles />");
270 ss.WriteLine(" </DeploymentInformation>"); 270 ss.WriteLine(" </DeploymentInformation>");
271 271
272 ss.WriteLine(" <Contents>"); 272 ss.WriteLine(" <Contents>");
273 foreach(string file in project.Files) 273 foreach(string file in project.Files)
274 { 274 {
275 string buildAction; 275 string buildAction;
276 string dependson = ""; 276 string dependson = "";
277 string resource_id = ""; 277 string resource_id = "";
278 string copyToOutput = ""; 278 string copyToOutput = "";
279 279
280 switch(project.Files.GetBuildAction(file)) 280 switch(project.Files.GetBuildAction(file))
281 { 281 {
282 case BuildAction.None: 282 case BuildAction.None:
283 buildAction = "Nothing"; 283 buildAction = "Nothing";
284 break; 284 break;
285 285
286 case BuildAction.Content: 286 case BuildAction.Content:
287 buildAction = "Exclude"; 287 buildAction = "Exclude";
288 break; 288 break;
289 289
290 case BuildAction.EmbeddedResource: 290 case BuildAction.EmbeddedResource:
291 buildAction = "EmbedAsResource"; 291 buildAction = "EmbedAsResource";
292 break; 292 break;
293 293
294 default: 294 default:
295 buildAction = "Compile"; 295 buildAction = "Compile";
296 break; 296 break;
297 } 297 }
298 298
299 if (project.Files.GetCopyToOutput(file) != CopyToOutput.Never) 299 if (project.Files.GetCopyToOutput(file) != CopyToOutput.Never)
300 buildAction = "FileCopy"; 300 buildAction = "FileCopy";
301 301
302 // Sort of a hack, we try and resolve the path and make it relative, if we can. 302 // Sort of a hack, we try and resolve the path and make it relative, if we can.
303 string extension = Path.GetExtension(file); 303 string extension = Path.GetExtension(file);
304 string designer_format = string.Format(".Designer{0}", extension); 304 string designer_format = string.Format(".Designer{0}", extension);
305 305
306 if (file.EndsWith(designer_format)) 306 if (file.EndsWith(designer_format))
307 { 307 {
308 string basename = file.Substring(0, file.LastIndexOf(designer_format)); 308 string basename = file.Substring(0, file.LastIndexOf(designer_format));
309 string[] extensions = new string[] { ".cs", ".resx", ".settings" }; 309 string[] extensions = new string[] { ".cs", ".resx", ".settings" };
310 310
311 foreach(string ext in extensions) 311 foreach(string ext in extensions)
312 { 312 {
313 if (project.Files.Contains(basename + ext)) 313 if (project.Files.Contains(basename + ext))
314 { 314 {
315 dependson = string.Format(" dependson=\"{0}{1}\"", basename, ext); 315 dependson = string.Format(" dependson=\"{0}{1}\"", basename, ext);
316 break; 316 break;
317 } 317 }
318 } 318 }
319 } 319 }
320 if (extension == ".resx") 320 if (extension == ".resx")
321 { 321 {
322 buildAction = "EmbedAsResource"; 322 buildAction = "EmbedAsResource";
323 string basename = file.Substring(0, file.LastIndexOf(".resx")); 323 string basename = file.Substring(0, file.LastIndexOf(".resx"));
324 324
325 // Visual Studio type resx + form dependency 325 // Visual Studio type resx + form dependency
326 if (project.Files.Contains(basename + ".cs")) 326 if (project.Files.Contains(basename + ".cs"))
327 { 327 {
328 dependson = string.Format(" dependson=\"{0}{1}\"", basename, ".cs"); 328 dependson = string.Format(" dependson=\"{0}{1}\"", basename, ".cs");
329 } 329 }
330 330
331 // We need to specify a resources file name to avoid MissingManifestResourceExceptions 331 // We need to specify a resources file name to avoid MissingManifestResourceExceptions
332 // in libraries that are built. 332 // in libraries that are built.
333 resource_id = string.Format(" resource_id=\"{0}.{1}.resources\"", 333 resource_id = string.Format(" resource_id=\"{0}.{1}.resources\"",
334 project.AssemblyName, basename.Replace("/", ".")); 334 project.AssemblyName, basename.Replace("/", "."));
335 } 335 }
336 336
337 switch(project.Files.GetCopyToOutput(file)) 337 switch(project.Files.GetCopyToOutput(file))
338 { 338 {
339 case CopyToOutput.Always: 339 case CopyToOutput.Always:
340 copyToOutput = string.Format(" copyToOutputDirectory=\"Always\""); 340 copyToOutput = string.Format(" copyToOutputDirectory=\"Always\"");
341 break; 341 break;
342 case CopyToOutput.PreserveNewest: 342 case CopyToOutput.PreserveNewest:
343 copyToOutput = string.Format(" copyToOutputDirectory=\"PreserveNewest\""); 343 copyToOutput = string.Format(" copyToOutputDirectory=\"PreserveNewest\"");
344 break; 344 break;
345 } 345 }
346 346
347 // Sort of a hack, we try and resolve the path and make it relative, if we can. 347 // Sort of a hack, we try and resolve the path and make it relative, if we can.
348 string filePath = PrependPath(file); 348 string filePath = PrependPath(file);
349 ss.WriteLine(" <File name=\"{0}\" subtype=\"Code\" buildaction=\"{1}\"{2}{3}{4} />", 349 ss.WriteLine(" <File name=\"{0}\" subtype=\"Code\" buildaction=\"{1}\"{2}{3}{4} />",
350 filePath, buildAction, dependson, resource_id, copyToOutput); 350 filePath, buildAction, dependson, resource_id, copyToOutput);
351 } 351 }
352 ss.WriteLine(" </Contents>"); 352 ss.WriteLine(" </Contents>");
353 353
354 ss.WriteLine(" <References>"); 354 ss.WriteLine(" <References>");
355 foreach(ReferenceNode refr in project.References) 355 foreach(ReferenceNode refr in project.References)
356 { 356 {
357 ss.WriteLine(" {0}", BuildReference(solution, refr)); 357 ss.WriteLine(" {0}", BuildReference(solution, refr));
358 } 358 }
359 ss.WriteLine(" </References>"); 359 ss.WriteLine(" </References>");
360 360
361 361
362 ss.WriteLine("</Project>"); 362 ss.WriteLine("</Project>");
363 } 363 }
364 364
365 m_Kernel.CurrentWorkingDirectory.Pop(); 365 m_Kernel.CurrentWorkingDirectory.Pop();
366 } 366 }
367 367
368 private void WriteCombine(SolutionNode solution) 368 private void WriteCombine(SolutionNode solution)
369 { 369 {
370 m_Kernel.Log.Write("Creating MonoDevelop combine and project files"); 370 m_Kernel.Log.Write("Creating MonoDevelop combine and project files");
371 foreach(ProjectNode project in solution.Projects) 371 foreach(ProjectNode project in solution.Projects)
372 { 372 {
373 if(m_Kernel.AllowProject(project.FilterGroups)) 373 if(m_Kernel.AllowProject(project.FilterGroups))
374 { 374 {
375 m_Kernel.Log.Write("...Creating project: {0}", project.Name); 375 m_Kernel.Log.Write("...Creating project: {0}", project.Name);
376 WriteProject(solution, project); 376 WriteProject(solution, project);
377 } 377 }
378 } 378 }
379 379
380 m_Kernel.Log.Write(""); 380 m_Kernel.Log.Write("");
381 string combFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "mds"); 381 string combFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "mds");
382 StreamWriter ss = new StreamWriter(combFile); 382 StreamWriter ss = new StreamWriter(combFile);
383 383
384 m_Kernel.CurrentWorkingDirectory.Push(); 384 m_Kernel.CurrentWorkingDirectory.Push();
385 Helper.SetCurrentDir(Path.GetDirectoryName(combFile)); 385 Helper.SetCurrentDir(Path.GetDirectoryName(combFile));
386 386
387 int count = 0; 387 int count = 0;
388 388
389 using(ss) 389 using(ss)
390 { 390 {
391 ss.WriteLine("<Combine name=\"{0}\" fileversion=\"2.0\" description=\"\">", solution.Name); 391 ss.WriteLine("<Combine name=\"{0}\" fileversion=\"2.0\" description=\"\">", solution.Name);
392 392
393 count = 0; 393 count = 0;
394 foreach(ConfigurationNode conf in solution.Configurations) 394 foreach(ConfigurationNode conf in solution.Configurations)
395 { 395 {
396 if(count == 0) 396 if(count == 0)
397 { 397 {
398 ss.WriteLine(" <Configurations active=\"{0}\">", conf.Name); 398 ss.WriteLine(" <Configurations active=\"{0}\">", conf.Name);
399 } 399 }
400 400
401 ss.WriteLine(" <Configuration name=\"{0}\" ctype=\"CombineConfiguration\">", conf.Name); 401 ss.WriteLine(" <Configuration name=\"{0}\" ctype=\"CombineConfiguration\">", conf.Name);
402 foreach(ProjectNode project in solution.Projects) 402 foreach(ProjectNode project in solution.Projects)
403 { 403 {
404 ss.WriteLine(" <Entry configuration=\"{1}\" build=\"True\" name=\"{0}\" />", project.Name, conf.Name); 404 ss.WriteLine(" <Entry configuration=\"{1}\" build=\"True\" name=\"{0}\" />", project.Name, conf.Name);
405 } 405 }
406 ss.WriteLine(" </Configuration>"); 406 ss.WriteLine(" </Configuration>");
407 407
408 count++; 408 count++;
409 } 409 }
410 ss.WriteLine(" </Configurations>"); 410 ss.WriteLine(" </Configurations>");
411 411
412 count = 0; 412 count = 0;
413 413
414 foreach(ProjectNode project in solution.Projects) 414 foreach(ProjectNode project in solution.Projects)
415 { 415 {
416 if(count == 0) 416 if(count == 0)
417 ss.WriteLine(" <StartMode startupentry=\"{0}\" single=\"True\">", project.Name); 417 ss.WriteLine(" <StartMode startupentry=\"{0}\" single=\"True\">", project.Name);
418 418
419 ss.WriteLine(" <Execute type=\"None\" entry=\"{0}\" />", project.Name); 419 ss.WriteLine(" <Execute type=\"None\" entry=\"{0}\" />", project.Name);
420 count++; 420 count++;
421 } 421 }
422 ss.WriteLine(" </StartMode>"); 422 ss.WriteLine(" </StartMode>");
423 423
424 ss.WriteLine(" <Entries>"); 424 ss.WriteLine(" <Entries>");
425 foreach(ProjectNode project in solution.Projects) 425 foreach(ProjectNode project in solution.Projects)
426 { 426 {
427 string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); 427 string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath);
428 ss.WriteLine(" <Entry filename=\"{0}\" />", 428 ss.WriteLine(" <Entry filename=\"{0}\" />",
429 Helper.MakeFilePath(path, project.Name, "mdp")); 429 Helper.MakeFilePath(path, project.Name, "mdp"));
430 } 430 }
431 ss.WriteLine(" </Entries>"); 431 ss.WriteLine(" </Entries>");
432 432
433 ss.WriteLine("</Combine>"); 433 ss.WriteLine("</Combine>");
434 } 434 }
435 435
436 m_Kernel.CurrentWorkingDirectory.Pop(); 436 m_Kernel.CurrentWorkingDirectory.Pop();
437 } 437 }
438 438
439 private void CleanProject(ProjectNode project) 439 private void CleanProject(ProjectNode project)
440 { 440 {
441 m_Kernel.Log.Write("...Cleaning project: {0}", project.Name); 441 m_Kernel.Log.Write("...Cleaning project: {0}", project.Name);
442 string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, "mdp"); 442 string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, "mdp");
443 Helper.DeleteIfExists(projectFile); 443 Helper.DeleteIfExists(projectFile);
444 } 444 }
445 445
446 private void CleanSolution(SolutionNode solution) 446 private void CleanSolution(SolutionNode solution)
447 { 447 {
448 m_Kernel.Log.Write("Cleaning MonoDevelop combine and project files for", solution.Name); 448 m_Kernel.Log.Write("Cleaning MonoDevelop combine and project files for", solution.Name);
449 449
450 string slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "mds"); 450 string slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "mds");
451 Helper.DeleteIfExists(slnFile); 451 Helper.DeleteIfExists(slnFile);
452 452
453 foreach(ProjectNode project in solution.Projects) 453 foreach(ProjectNode project in solution.Projects)
454 { 454 {
455 CleanProject(project); 455 CleanProject(project);
456 } 456 }
457 457
458 m_Kernel.Log.Write(""); 458 m_Kernel.Log.Write("");
459 } 459 }
460 460
461 #endregion 461 #endregion
462 462
463 #region ITarget Members 463 #region ITarget Members
464 464
465 /// <summary> 465 /// <summary>
466 /// Writes the specified kern. 466 /// Writes the specified kern.
467 /// </summary> 467 /// </summary>
468 /// <param name="kern">The kern.</param> 468 /// <param name="kern">The kern.</param>
469 public void Write(Kernel kern) 469 public void Write(Kernel kern)
470 { 470 {
471 if( kern == null ) 471 if( kern == null )
472 { 472 {
473 throw new ArgumentNullException("kern"); 473 throw new ArgumentNullException("kern");
474 } 474 }
475 m_Kernel = kern; 475 m_Kernel = kern;
476 foreach(SolutionNode solution in kern.Solutions) 476 foreach(SolutionNode solution in kern.Solutions)
477 { 477 {
478 WriteCombine(solution); 478 WriteCombine(solution);
479 } 479 }
480 m_Kernel = null; 480 m_Kernel = null;
481 } 481 }
482 482
483 /// <summary> 483 /// <summary>
484 /// Cleans the specified kern. 484 /// Cleans the specified kern.
485 /// </summary> 485 /// </summary>
486 /// <param name="kern">The kern.</param> 486 /// <param name="kern">The kern.</param>
487 public virtual void Clean(Kernel kern) 487 public virtual void Clean(Kernel kern)
488 { 488 {
489 if( kern == null ) 489 if( kern == null )
490 { 490 {
491 throw new ArgumentNullException("kern"); 491 throw new ArgumentNullException("kern");
492 } 492 }
493 m_Kernel = kern; 493 m_Kernel = kern;
494 foreach(SolutionNode sol in kern.Solutions) 494 foreach(SolutionNode sol in kern.Solutions)
495 { 495 {
496 CleanSolution(sol); 496 CleanSolution(sol);
497 } 497 }
498 m_Kernel = null; 498 m_Kernel = null;
499 } 499 }
500 500
501 /// <summary> 501 /// <summary>
502 /// Gets the name. 502 /// Gets the name.
503 /// </summary> 503 /// </summary>
504 /// <value>The name.</value> 504 /// <value>The name.</value>
505 public string Name 505 public string Name
506 { 506 {
507 get 507 get
508 { 508 {
509 return "sharpdev"; 509 return "sharpdev";
510 } 510 }
511 } 511 }
512 512
513 #endregion 513 #endregion
514 } 514 }
515} 515}
diff --git a/Prebuild/src/Core/Targets/NAntTarget.cs b/Prebuild/src/Core/Targets/NAntTarget.cs
index 21bc80e..925f5ca 100644
--- a/Prebuild/src/Core/Targets/NAntTarget.cs
+++ b/Prebuild/src/Core/Targets/NAntTarget.cs
@@ -47,36 +47,36 @@ using Prebuild.Core.Utilities;
47 47
48namespace Prebuild.Core.Targets 48namespace Prebuild.Core.Targets
49{ 49{
50 /// <summary> 50 /// <summary>
51 /// 51 ///
52 /// </summary> 52 /// </summary>
53 [Target("nant")] 53 [Target("nant")]
54 public class NAntTarget : ITarget 54 public class NAntTarget : ITarget
55 { 55 {
56 #region Fields 56 #region Fields
57 57
58 private Kernel m_Kernel; 58 private Kernel m_Kernel;
59 59
60 #endregion 60 #endregion
61 61
62 #region Private Methods 62 #region Private Methods
63 63
64 private static string PrependPath(string path) 64 private static string PrependPath(string path)
65 { 65 {
66 string tmpPath = Helper.NormalizePath(path, '/'); 66 string tmpPath = Helper.NormalizePath(path, '/');
67 Regex regex = new Regex(@"(\w):/(\w+)"); 67 Regex regex = new Regex(@"(\w):/(\w+)");
68 Match match = regex.Match(tmpPath); 68 Match match = regex.Match(tmpPath);
69 //if(match.Success || tmpPath[0] == '.' || tmpPath[0] == '/') 69 //if(match.Success || tmpPath[0] == '.' || tmpPath[0] == '/')
70 //{ 70 //{
71 tmpPath = Helper.NormalizePath(tmpPath); 71 tmpPath = Helper.NormalizePath(tmpPath);
72 //} 72 //}
73 // else 73 // else
74 // { 74 // {
75 // tmpPath = Helper.NormalizePath("./" + tmpPath); 75 // tmpPath = Helper.NormalizePath("./" + tmpPath);
76 // } 76 // }
77 77
78 return tmpPath; 78 return tmpPath;
79 } 79 }
80 80
81 private static string BuildReference(SolutionNode solution, ProjectNode currentProject, ReferenceNode refr) 81 private static string BuildReference(SolutionNode solution, ProjectNode currentProject, ReferenceNode refr)
82 { 82 {
@@ -85,7 +85,7 @@ namespace Prebuild.Core.Targets
85 { 85 {
86 return refr.Path; 86 return refr.Path;
87 } 87 }
88 88
89 if (solution.ProjectsTable.ContainsKey(refr.Name)) 89 if (solution.ProjectsTable.ContainsKey(refr.Name))
90 { 90 {
91 ProjectNode projectRef = (ProjectNode) solution.ProjectsTable[refr.Name]; 91 ProjectNode projectRef = (ProjectNode) solution.ProjectsTable[refr.Name];
@@ -113,7 +113,7 @@ namespace Prebuild.Core.Targets
113 return refr.Name + ".dll"; 113 return refr.Name + ".dll";
114 } 114 }
115 115
116 public static string GetRefFileName(string refName) 116 public static string GetRefFileName(string refName)
117 { 117 {
118 if (ExtensionSpecified(refName)) 118 if (ExtensionSpecified(refName))
119 { 119 {
@@ -140,11 +140,11 @@ namespace Prebuild.Core.Targets
140 return extension; 140 return extension;
141 } 141 }
142 142
143 private static string FindFileReference(string refName, ProjectNode project) 143 private static string FindFileReference(string refName, ProjectNode project)
144 { 144 {
145 foreach (ReferencePathNode refPath in project.ReferencePaths) 145 foreach (ReferencePathNode refPath in project.ReferencePaths)
146 { 146 {
147 string fullPath = Helper.MakeFilePath(refPath.Path, refName); 147 string fullPath = Helper.MakeFilePath(refPath.Path, refName);
148 148
149 if (File.Exists(fullPath)) 149 if (File.Exists(fullPath))
150 { 150 {
@@ -153,10 +153,10 @@ namespace Prebuild.Core.Targets
153 153
154 fullPath = Helper.MakeFilePath(refPath.Path, refName, "dll"); 154 fullPath = Helper.MakeFilePath(refPath.Path, refName, "dll");
155 155
156 if (File.Exists(fullPath)) 156 if (File.Exists(fullPath))
157 { 157 {
158 return fullPath; 158 return fullPath;
159 } 159 }
160 160
161 fullPath = Helper.MakeFilePath(refPath.Path, refName, "exe"); 161 fullPath = Helper.MakeFilePath(refPath.Path, refName, "exe");
162 162
@@ -164,162 +164,205 @@ namespace Prebuild.Core.Targets
164 { 164 {
165 return fullPath; 165 return fullPath;
166 } 166 }
167 } 167 }
168 168
169 return null; 169 return null;
170 } 170 }
171 171
172 /// <summary> 172 /// <summary>
173 /// Gets the XML doc file. 173 /// Gets the XML doc file.
174 /// </summary> 174 /// </summary>
175 /// <param name="project">The project.</param> 175 /// <param name="project">The project.</param>
176 /// <param name="conf">The conf.</param> 176 /// <param name="conf">The conf.</param>
177 /// <returns></returns> 177 /// <returns></returns>
178 public static string GetXmlDocFile(ProjectNode project, ConfigurationNode conf) 178 public static string GetXmlDocFile(ProjectNode project, ConfigurationNode conf)
179 { 179 {
180 if (conf == null) 180 if (conf == null)
181 { 181 {
182 throw new ArgumentNullException("conf"); 182 throw new ArgumentNullException("conf");
183 } 183 }
184 if (project == null) 184 if (project == null)
185 { 185 {
186 throw new ArgumentNullException("project"); 186 throw new ArgumentNullException("project");
187 } 187 }
188 string docFile = (string)conf.Options["XmlDocFile"]; 188 string docFile = (string)conf.Options["XmlDocFile"];
189 // if(docFile != null && docFile.Length == 0)//default to assembly name if not specified 189 // if(docFile != null && docFile.Length == 0)//default to assembly name if not specified
190 // { 190 // {
191 // return Path.GetFileNameWithoutExtension(project.AssemblyName) + ".xml"; 191 // return Path.GetFileNameWithoutExtension(project.AssemblyName) + ".xml";
192 // } 192 // }
193 return docFile; 193 return docFile;
194 } 194 }
195 195
196 private void WriteProject(SolutionNode solution, ProjectNode project) 196 private void WriteProject(SolutionNode solution, ProjectNode project)
197 { 197 {
198 string projFile = Helper.MakeFilePath(project.FullPath, project.Name + GetProjectExtension(project), "build"); 198 string projFile = Helper.MakeFilePath(project.FullPath, project.Name + GetProjectExtension(project), "build");
199 StreamWriter ss = new StreamWriter(projFile); 199 StreamWriter ss = new StreamWriter(projFile);
200 200
201 m_Kernel.CurrentWorkingDirectory.Push(); 201 m_Kernel.CurrentWorkingDirectory.Push();
202 Helper.SetCurrentDir(Path.GetDirectoryName(projFile)); 202 Helper.SetCurrentDir(Path.GetDirectoryName(projFile));
203 bool hasDoc = false; 203 bool hasDoc = false;
204 204
205 using (ss) 205 using (ss)
206 { 206 {
207 ss.WriteLine("<?xml version=\"1.0\" ?>"); 207 ss.WriteLine("<?xml version=\"1.0\" ?>");
208 ss.WriteLine("<project name=\"{0}\" default=\"build\">", project.Name); 208 ss.WriteLine("<project name=\"{0}\" default=\"build\">", project.Name);
209 ss.WriteLine(" <target name=\"{0}\">", "build"); 209 ss.WriteLine(" <target name=\"{0}\">", "build");
210 ss.WriteLine(" <echo message=\"Build Directory is ${project::get-base-directory()}/${build.dir}\" />"); 210 ss.WriteLine(" <echo message=\"Build Directory is ${project::get-base-directory()}/${build.dir}\" />");
211 ss.WriteLine(" <mkdir dir=\"${project::get-base-directory()}/${build.dir}\" />"); 211 ss.WriteLine(" <mkdir dir=\"${project::get-base-directory()}/${build.dir}\" />");
212 212 ss.WriteLine(" <copy todir=\"${project::get-base-directory()}/${build.dir}\" flatten=\"true\">");
213 ss.Write(" <csc "); 213 ss.WriteLine(" <fileset basedir=\"${project::get-base-directory()}\">");
214 ss.Write(" target=\"{0}\"", project.Type.ToString().ToLower()); 214 foreach (ReferenceNode refr in project.References)
215 ss.Write(" debug=\"{0}\"", "${build.debug}"); 215 {
216 ss.Write(" platform=\"${build.platform}\""); 216 if (refr.LocalCopy)
217 217 {
218 218 ss.WriteLine(" <include name=\"{0}", Helper.NormalizePath(Helper.MakePathRelativeTo(project.FullPath, BuildReference(solution, project, refr)) + "\" />", '/'));
219 foreach (ConfigurationNode conf in project.Configurations) 219 }
220 { 220 }
221 if (conf.Options.KeyFile != "") 221
222 { 222 ss.WriteLine(" </fileset>");
223 ss.Write(" keyfile=\"{0}\"", conf.Options.KeyFile); 223 ss.WriteLine(" </copy>");
224 break; 224 if (project.ConfigFile != null && project.ConfigFile.Length!=0)
225 } 225 {
226 } 226 ss.Write(" <copy file=\"" + project.ConfigFile + "\" tofile=\"${project::get-base-directory()}/${build.dir}/${project::get-name()}");
227 foreach (ConfigurationNode conf in project.Configurations) 227
228 { 228 if (project.Type == ProjectType.Library)
229 ss.Write(" unsafe=\"{0}\"", conf.Options.AllowUnsafe); 229 {
230 break; 230 ss.Write(".dll.config\"");
231 } 231 }
232 foreach (ConfigurationNode conf in project.Configurations) 232 else
233 { 233 {
234 ss.Write(" warnaserror=\"{0}\"", conf.Options.WarningsAsErrors); 234 ss.Write(".exe.config\"");
235 break; 235 }
236 } 236 ss.WriteLine(" />");
237 foreach (ConfigurationNode conf in project.Configurations) 237 }
238 { 238
239 ss.Write(" define=\"{0}\"", conf.Options.CompilerDefines); 239 // Add the content files to just be copied
240 break; 240 ss.WriteLine(" {0}", "<copy todir=\"${project::get-base-directory()}/${build.dir}\">");
241 } 241 ss.WriteLine(" {0}", "<fileset basedir=\".\">");
242 foreach (ConfigurationNode conf in project.Configurations) 242
243 { 243 foreach (string file in project.Files)
244 ss.Write(" nostdlib=\"{0}\"", conf.Options["NoStdLib"]); 244 {
245 break; 245 // Ignore if we aren't content
246 } 246 if (project.Files.GetBuildAction(file) != BuildAction.Content)
247 247 continue;
248 ss.Write(" main=\"{0}\"", project.StartupObject); 248
249 249 // Create a include tag
250 foreach (ConfigurationNode conf in project.Configurations) 250 ss.WriteLine(" {0}", "<include name=\"" + Helper.NormalizePath(PrependPath(file), '/') + "\" />");
251 { 251 }
252 if (GetXmlDocFile(project, conf) != "") 252
253 { 253 ss.WriteLine(" {0}", "</fileset>");
254 ss.Write(" doc=\"{0}\"", "${project::get-base-directory()}/${build.dir}/" + GetXmlDocFile(project, conf)); 254 ss.WriteLine(" {0}", "</copy>");
255 hasDoc = true; 255
256 } 256 ss.Write(" <csc ");
257 break; 257 ss.Write(" target=\"{0}\"", project.Type.ToString().ToLower());
258 } 258 ss.Write(" debug=\"{0}\"", "${build.debug}");
259 ss.Write(" output=\"{0}", "${project::get-base-directory()}/${build.dir}/${project::get-name()}"); 259 ss.Write(" platform=\"${build.platform}\"");
260 if (project.Type == ProjectType.Library) 260
261 { 261
262 ss.Write(".dll\""); 262 foreach (ConfigurationNode conf in project.Configurations)
263 } 263 {
264 else 264 if (conf.Options.KeyFile != "")
265 { 265 {
266 ss.Write(".exe\""); 266 ss.Write(" keyfile=\"{0}\"", conf.Options.KeyFile);
267 } 267 break;
268 if (project.AppIcon != null && project.AppIcon.Length != 0) 268 }
269 { 269 }
270 ss.Write(" win32icon=\"{0}\"", Helper.NormalizePath(project.AppIcon, '/')); 270 foreach (ConfigurationNode conf in project.Configurations)
271 } 271 {
272 ss.Write(" unsafe=\"{0}\"", conf.Options.AllowUnsafe);
273 break;
274 }
275 foreach (ConfigurationNode conf in project.Configurations)
276 {
277 ss.Write(" warnaserror=\"{0}\"", conf.Options.WarningsAsErrors);
278 break;
279 }
280 foreach (ConfigurationNode conf in project.Configurations)
281 {
282 ss.Write(" define=\"{0}\"", conf.Options.CompilerDefines);
283 break;
284 }
285 foreach (ConfigurationNode conf in project.Configurations)
286 {
287 ss.Write(" nostdlib=\"{0}\"", conf.Options["NoStdLib"]);
288 break;
289 }
290
291 ss.Write(" main=\"{0}\"", project.StartupObject);
292
293 foreach (ConfigurationNode conf in project.Configurations)
294 {
295 if (GetXmlDocFile(project, conf) != "")
296 {
297 ss.Write(" doc=\"{0}\"", "${project::get-base-directory()}/${build.dir}/" + GetXmlDocFile(project, conf));
298 hasDoc = true;
299 }
300 break;
301 }
302 ss.Write(" output=\"{0}", "${project::get-base-directory()}/${build.dir}/${project::get-name()}");
303 if (project.Type == ProjectType.Library)
304 {
305 ss.Write(".dll\"");
306 }
307 else
308 {
309 ss.Write(".exe\"");
310 }
311 if (project.AppIcon != null && project.AppIcon.Length != 0)
312 {
313 ss.Write(" win32icon=\"{0}\"", Helper.NormalizePath(project.AppIcon, '/'));
314 }
272 // This disables a very different behavior between VS and NAnt. With Nant, 315 // This disables a very different behavior between VS and NAnt. With Nant,
273 // If you have using System.Xml; it will ensure System.Xml.dll is referenced, 316 // If you have using System.Xml; it will ensure System.Xml.dll is referenced,
274 // but not in VS. This will force the behaviors to match, so when it works 317 // but not in VS. This will force the behaviors to match, so when it works
275 // in nant, it will work in VS. 318 // in nant, it will work in VS.
276 ss.Write(" noconfig=\"true\""); 319 ss.Write(" noconfig=\"true\"");
277 ss.WriteLine(">"); 320 ss.WriteLine(">");
278 ss.WriteLine(" <resources prefix=\"{0}\" dynamicprefix=\"true\" >", project.RootNamespace); 321 ss.WriteLine(" <resources prefix=\"{0}\" dynamicprefix=\"true\" >", project.RootNamespace);
279 foreach (string file in project.Files) 322 foreach (string file in project.Files)
280 { 323 {
281 switch (project.Files.GetBuildAction(file)) 324 switch (project.Files.GetBuildAction(file))
282 { 325 {
283 case BuildAction.EmbeddedResource: 326 case BuildAction.EmbeddedResource:
284 ss.WriteLine(" {0}", "<include name=\"" + Helper.NormalizePath(PrependPath(file), '/') + "\" />"); 327 ss.WriteLine(" {0}", "<include name=\"" + Helper.NormalizePath(PrependPath(file), '/') + "\" />");
285 break; 328 break;
286 default: 329 default:
287 if (project.Files.GetSubType(file) != SubType.Code && project.Files.GetSubType(file) != SubType.Settings) 330 if (project.Files.GetSubType(file) != SubType.Code && project.Files.GetSubType(file) != SubType.Settings)
288 { 331 {
289 ss.WriteLine(" <include name=\"{0}\" />", file.Substring(0, file.LastIndexOf('.')) + ".resx"); 332 ss.WriteLine(" <include name=\"{0}\" />", file.Substring(0, file.LastIndexOf('.')) + ".resx");
290 } 333 }
291 break; 334 break;
292 } 335 }
293 } 336 }
294 //if (project.Files.GetSubType(file).ToString() != "Code") 337 //if (project.Files.GetSubType(file).ToString() != "Code")
295 //{ 338 //{
296 // ps.WriteLine(" <EmbeddedResource Include=\"{0}\">", file.Substring(0, file.LastIndexOf('.')) + ".resx"); 339 // ps.WriteLine(" <EmbeddedResource Include=\"{0}\">", file.Substring(0, file.LastIndexOf('.')) + ".resx");
297 340
298 ss.WriteLine(" </resources>"); 341 ss.WriteLine(" </resources>");
299 ss.WriteLine(" <sources failonempty=\"true\">"); 342 ss.WriteLine(" <sources failonempty=\"true\">");
300 foreach (string file in project.Files) 343 foreach (string file in project.Files)
301 { 344 {
302 switch (project.Files.GetBuildAction(file)) 345 switch (project.Files.GetBuildAction(file))
303 { 346 {
304 case BuildAction.Compile: 347 case BuildAction.Compile:
305 ss.WriteLine(" <include name=\"" + Helper.NormalizePath(PrependPath(file), '/') + "\" />"); 348 ss.WriteLine(" <include name=\"" + Helper.NormalizePath(PrependPath(file), '/') + "\" />");
306 break; 349 break;
307 default: 350 default:
308 break; 351 break;
309 } 352 }
310 } 353 }
311 ss.WriteLine(" </sources>"); 354 ss.WriteLine(" </sources>");
312 ss.WriteLine(" <references basedir=\"${project::get-base-directory()}\">"); 355 ss.WriteLine(" <references basedir=\"${project::get-base-directory()}\">");
313 ss.WriteLine(" <lib>"); 356 ss.WriteLine(" <lib>");
314 ss.WriteLine(" <include name=\"${project::get-base-directory()}\" />"); 357 ss.WriteLine(" <include name=\"${project::get-base-directory()}\" />");
315 foreach(ReferencePathNode refPath in project.ReferencePaths) 358 foreach(ReferencePathNode refPath in project.ReferencePaths)
316 { 359 {
317 ss.WriteLine(" <include name=\"${project::get-base-directory()}/" + refPath.Path.TrimEnd('/', '\\') + "\" />"); 360 ss.WriteLine(" <include name=\"${project::get-base-directory()}/" + refPath.Path.TrimEnd('/', '\\') + "\" />");
318 } 361 }
319 ss.WriteLine(" </lib>"); 362 ss.WriteLine(" </lib>");
320 foreach (ReferenceNode refr in project.References) 363 foreach (ReferenceNode refr in project.References)
321 { 364 {
322 string path = Helper.NormalizePath(Helper.MakePathRelativeTo(project.FullPath, BuildReference(solution, project, refr)), '/'); 365 string path = Helper.NormalizePath(Helper.MakePathRelativeTo(project.FullPath, BuildReference(solution, project, refr)), '/');
323 if (refr.Path != null) { 366 if (refr.Path != null) {
324 if (ExtensionSpecified(refr.Name)) 367 if (ExtensionSpecified(refr.Name))
325 { 368 {
@@ -334,12 +377,12 @@ namespace Prebuild.Core.Targets
334 { 377 {
335 ss.WriteLine (" <include name=\"" + path + "\" />"); 378 ss.WriteLine (" <include name=\"" + path + "\" />");
336 } 379 }
337 } 380 }
338 ss.WriteLine(" </references>"); 381 ss.WriteLine(" </references>");
339 382
340 ss.WriteLine(" </csc>"); 383 ss.WriteLine(" </csc>");
341 384
342 foreach (ConfigurationNode conf in project.Configurations) 385 foreach (ConfigurationNode conf in project.Configurations)
343 { 386 {
344 if (!String.IsNullOrEmpty(conf.Options.OutputPath)) 387 if (!String.IsNullOrEmpty(conf.Options.OutputPath))
345 { 388 {
@@ -361,170 +404,170 @@ namespace Prebuild.Core.Targets
361 } 404 }
362 } 405 }
363 406
364 ss.WriteLine(" </target>"); 407 ss.WriteLine(" </target>");
365 408
366 ss.WriteLine(" <target name=\"clean\">"); 409 ss.WriteLine(" <target name=\"clean\">");
367 ss.WriteLine(" <delete dir=\"${bin.dir}\" failonerror=\"false\" />"); 410 ss.WriteLine(" <delete dir=\"${bin.dir}\" failonerror=\"false\" />");
368 ss.WriteLine(" <delete dir=\"${obj.dir}\" failonerror=\"false\" />"); 411 ss.WriteLine(" <delete dir=\"${obj.dir}\" failonerror=\"false\" />");
369 ss.WriteLine(" </target>"); 412 ss.WriteLine(" </target>");
370 413
371 ss.WriteLine(" <target name=\"doc\" description=\"Creates documentation.\">"); 414 ss.WriteLine(" <target name=\"doc\" description=\"Creates documentation.\">");
372 if (hasDoc) 415 if (hasDoc)
373 { 416 {
374 ss.WriteLine(" <property name=\"doc.target\" value=\"\" />"); 417 ss.WriteLine(" <property name=\"doc.target\" value=\"\" />");
375 ss.WriteLine(" <if test=\"${platform::is-unix()}\">"); 418 ss.WriteLine(" <if test=\"${platform::is-unix()}\">");
376 ss.WriteLine(" <property name=\"doc.target\" value=\"Web\" />"); 419 ss.WriteLine(" <property name=\"doc.target\" value=\"Web\" />");
377 ss.WriteLine(" </if>"); 420 ss.WriteLine(" </if>");
378 ss.WriteLine(" <ndoc failonerror=\"false\" verbose=\"true\">"); 421 ss.WriteLine(" <ndoc failonerror=\"false\" verbose=\"true\">");
379 ss.WriteLine(" <assemblies basedir=\"${project::get-base-directory()}\">"); 422 ss.WriteLine(" <assemblies basedir=\"${project::get-base-directory()}\">");
380 ss.Write(" <include name=\"${build.dir}/${project::get-name()}"); 423 ss.Write(" <include name=\"${build.dir}/${project::get-name()}");
381 if (project.Type == ProjectType.Library) 424 if (project.Type == ProjectType.Library)
382 { 425 {
383 ss.WriteLine(".dll\" />"); 426 ss.WriteLine(".dll\" />");
384 } 427 }
385 else 428 else
386 { 429 {
387 ss.WriteLine(".exe\" />"); 430 ss.WriteLine(".exe\" />");
388 } 431 }
389 432
390 ss.WriteLine(" </assemblies>"); 433 ss.WriteLine(" </assemblies>");
391 ss.WriteLine(" <summaries basedir=\"${project::get-base-directory()}\">"); 434 ss.WriteLine(" <summaries basedir=\"${project::get-base-directory()}\">");
392 ss.WriteLine(" <include name=\"${build.dir}/${project::get-name()}.xml\"/>"); 435 ss.WriteLine(" <include name=\"${build.dir}/${project::get-name()}.xml\"/>");
393 ss.WriteLine(" </summaries>"); 436 ss.WriteLine(" </summaries>");
394 ss.WriteLine(" <referencepaths basedir=\"${project::get-base-directory()}\">"); 437 ss.WriteLine(" <referencepaths basedir=\"${project::get-base-directory()}\">");
395 ss.WriteLine(" <include name=\"${build.dir}\" />"); 438 ss.WriteLine(" <include name=\"${build.dir}\" />");
396 // foreach(ReferenceNode refr in project.References) 439 // foreach(ReferenceNode refr in project.References)
397 // { 440 // {
398 // string path = Helper.NormalizePath(Helper.MakePathRelativeTo(project.FullPath, BuildReferencePath(solution, refr)), '/'); 441 // string path = Helper.NormalizePath(Helper.MakePathRelativeTo(project.FullPath, BuildReferencePath(solution, refr)), '/');
399 // if (path != "") 442 // if (path != "")
400 // { 443 // {
401 // ss.WriteLine(" <include name=\"{0}\" />", path); 444 // ss.WriteLine(" <include name=\"{0}\" />", path);
402 // } 445 // }
403 // } 446 // }
404 ss.WriteLine(" </referencepaths>"); 447 ss.WriteLine(" </referencepaths>");
405 ss.WriteLine(" <documenters>"); 448 ss.WriteLine(" <documenters>");
406 ss.WriteLine(" <documenter name=\"MSDN\">"); 449 ss.WriteLine(" <documenter name=\"MSDN\">");
407 ss.WriteLine(" <property name=\"OutputDirectory\" value=\"${project::get-base-directory()}/${build.dir}/doc/${project::get-name()}\" />"); 450 ss.WriteLine(" <property name=\"OutputDirectory\" value=\"${project::get-base-directory()}/${build.dir}/doc/${project::get-name()}\" />");
408 ss.WriteLine(" <property name=\"OutputTarget\" value=\"${doc.target}\" />"); 451 ss.WriteLine(" <property name=\"OutputTarget\" value=\"${doc.target}\" />");
409 ss.WriteLine(" <property name=\"HtmlHelpName\" value=\"${project::get-name()}\" />"); 452 ss.WriteLine(" <property name=\"HtmlHelpName\" value=\"${project::get-name()}\" />");
410 ss.WriteLine(" <property name=\"IncludeFavorites\" value=\"False\" />"); 453 ss.WriteLine(" <property name=\"IncludeFavorites\" value=\"False\" />");
411 ss.WriteLine(" <property name=\"Title\" value=\"${project::get-name()} SDK Documentation\" />"); 454 ss.WriteLine(" <property name=\"Title\" value=\"${project::get-name()} SDK Documentation\" />");
412 ss.WriteLine(" <property name=\"SplitTOCs\" value=\"False\" />"); 455 ss.WriteLine(" <property name=\"SplitTOCs\" value=\"False\" />");
413 ss.WriteLine(" <property name=\"DefaulTOC\" value=\"\" />"); 456 ss.WriteLine(" <property name=\"DefaulTOC\" value=\"\" />");
414 ss.WriteLine(" <property name=\"ShowVisualBasic\" value=\"True\" />"); 457 ss.WriteLine(" <property name=\"ShowVisualBasic\" value=\"True\" />");
415 ss.WriteLine(" <property name=\"AutoDocumentConstructors\" value=\"True\" />"); 458 ss.WriteLine(" <property name=\"AutoDocumentConstructors\" value=\"True\" />");
416 ss.WriteLine(" <property name=\"ShowMissingSummaries\" value=\"${build.debug}\" />"); 459 ss.WriteLine(" <property name=\"ShowMissingSummaries\" value=\"${build.debug}\" />");
417 ss.WriteLine(" <property name=\"ShowMissingRemarks\" value=\"${build.debug}\" />"); 460 ss.WriteLine(" <property name=\"ShowMissingRemarks\" value=\"${build.debug}\" />");
418 ss.WriteLine(" <property name=\"ShowMissingParams\" value=\"${build.debug}\" />"); 461 ss.WriteLine(" <property name=\"ShowMissingParams\" value=\"${build.debug}\" />");
419 ss.WriteLine(" <property name=\"ShowMissingReturns\" value=\"${build.debug}\" />"); 462 ss.WriteLine(" <property name=\"ShowMissingReturns\" value=\"${build.debug}\" />");
420 ss.WriteLine(" <property name=\"ShowMissingValues\" value=\"${build.debug}\" />"); 463 ss.WriteLine(" <property name=\"ShowMissingValues\" value=\"${build.debug}\" />");
421 ss.WriteLine(" <property name=\"DocumentInternals\" value=\"False\" />"); 464 ss.WriteLine(" <property name=\"DocumentInternals\" value=\"False\" />");
422 ss.WriteLine(" <property name=\"DocumentPrivates\" value=\"False\" />"); 465 ss.WriteLine(" <property name=\"DocumentPrivates\" value=\"False\" />");
423 ss.WriteLine(" <property name=\"DocumentProtected\" value=\"True\" />"); 466 ss.WriteLine(" <property name=\"DocumentProtected\" value=\"True\" />");
424 ss.WriteLine(" <property name=\"DocumentEmptyNamespaces\" value=\"${build.debug}\" />"); 467 ss.WriteLine(" <property name=\"DocumentEmptyNamespaces\" value=\"${build.debug}\" />");
425 ss.WriteLine(" <property name=\"IncludeAssemblyVersion\" value=\"True\" />"); 468 ss.WriteLine(" <property name=\"IncludeAssemblyVersion\" value=\"True\" />");
426 ss.WriteLine(" </documenter>"); 469 ss.WriteLine(" </documenter>");
427 ss.WriteLine(" </documenters>"); 470 ss.WriteLine(" </documenters>");
428 ss.WriteLine(" </ndoc>"); 471 ss.WriteLine(" </ndoc>");
429 } 472 }
430 ss.WriteLine(" </target>"); 473 ss.WriteLine(" </target>");
431 ss.WriteLine("</project>"); 474 ss.WriteLine("</project>");
432 } 475 }
433 m_Kernel.CurrentWorkingDirectory.Pop(); 476 m_Kernel.CurrentWorkingDirectory.Pop();
434 } 477 }
435 478
436 private void WriteCombine(SolutionNode solution) 479 private void WriteCombine(SolutionNode solution)
437 { 480 {
438 m_Kernel.Log.Write("Creating NAnt build files"); 481 m_Kernel.Log.Write("Creating NAnt build files");
439 foreach (ProjectNode project in solution.Projects) 482 foreach (ProjectNode project in solution.Projects)
440 { 483 {
441 if (m_Kernel.AllowProject(project.FilterGroups)) 484 if (m_Kernel.AllowProject(project.FilterGroups))
442 { 485 {
443 m_Kernel.Log.Write("...Creating project: {0}", project.Name); 486 m_Kernel.Log.Write("...Creating project: {0}", project.Name);
444 WriteProject(solution, project); 487 WriteProject(solution, project);
445 } 488 }
446 } 489 }
447 490
448 m_Kernel.Log.Write(""); 491 m_Kernel.Log.Write("");
449 string combFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "build"); 492 string combFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "build");
450 StreamWriter ss = new StreamWriter(combFile); 493 StreamWriter ss = new StreamWriter(combFile);
451 494
452 m_Kernel.CurrentWorkingDirectory.Push(); 495 m_Kernel.CurrentWorkingDirectory.Push();
453 Helper.SetCurrentDir(Path.GetDirectoryName(combFile)); 496 Helper.SetCurrentDir(Path.GetDirectoryName(combFile));
454 497
455 using (ss) 498 using (ss)
456 { 499 {
457 ss.WriteLine("<?xml version=\"1.0\" ?>"); 500 ss.WriteLine("<?xml version=\"1.0\" ?>");
458 ss.WriteLine("<project name=\"{0}\" default=\"build\">", solution.Name); 501 ss.WriteLine("<project name=\"{0}\" default=\"build\">", solution.Name);
459 ss.WriteLine(" <echo message=\"Using '${nant.settings.currentframework}' Framework\"/>"); 502 ss.WriteLine(" <echo message=\"Using '${nant.settings.currentframework}' Framework\"/>");
460 ss.WriteLine(); 503 ss.WriteLine();
461 504
462 //ss.WriteLine(" <property name=\"dist.dir\" value=\"dist\" />"); 505 //ss.WriteLine(" <property name=\"dist.dir\" value=\"dist\" />");
463 //ss.WriteLine(" <property name=\"source.dir\" value=\"source\" />"); 506 //ss.WriteLine(" <property name=\"source.dir\" value=\"source\" />");
464 ss.WriteLine(" <property name=\"bin.dir\" value=\"bin\" />"); 507 ss.WriteLine(" <property name=\"bin.dir\" value=\"bin\" />");
465 ss.WriteLine(" <property name=\"obj.dir\" value=\"obj\" />"); 508 ss.WriteLine(" <property name=\"obj.dir\" value=\"obj\" />");
466 ss.WriteLine(" <property name=\"doc.dir\" value=\"doc\" />"); 509 ss.WriteLine(" <property name=\"doc.dir\" value=\"doc\" />");
467 ss.WriteLine(" <property name=\"project.main.dir\" value=\"${project::get-base-directory()}\" />"); 510 ss.WriteLine(" <property name=\"project.main.dir\" value=\"${project::get-base-directory()}\" />");
468 511
469 // Use the active configuration, which is the first configuration name in the prebuild file. 512 // Use the active configuration, which is the first configuration name in the prebuild file.
470 Dictionary<string,string> emittedConfigurations = new Dictionary<string, string>(); 513 Dictionary<string,string> emittedConfigurations = new Dictionary<string, string>();
471 514
472 ss.WriteLine(" <property name=\"project.config\" value=\"{0}\" />", solution.ActiveConfig); 515 ss.WriteLine(" <property name=\"project.config\" value=\"{0}\" />", solution.ActiveConfig);
473 ss.WriteLine(); 516 ss.WriteLine();
474 517
475 foreach (ConfigurationNode conf in solution.Configurations) 518 foreach (ConfigurationNode conf in solution.Configurations)
476 { 519 {
477 // If the name isn't in the emitted configurations, we give a high level target to the 520 // If the name isn't in the emitted configurations, we give a high level target to the
478 // platform specific on. This lets "Debug" point to "Debug-AnyCPU". 521 // platform specific on. This lets "Debug" point to "Debug-AnyCPU".
479 if (!emittedConfigurations.ContainsKey(conf.Name)) 522 if (!emittedConfigurations.ContainsKey(conf.Name))
480 { 523 {
481 // Add it to the dictionary so we only emit one. 524 // Add it to the dictionary so we only emit one.
482 emittedConfigurations.Add(conf.Name, conf.Platform); 525 emittedConfigurations.Add(conf.Name, conf.Platform);
483 526
484 // Write out the target block. 527 // Write out the target block.
485 ss.WriteLine(" <target name=\"{0}\" description=\"{0}|{1}\" depends=\"{0}-{1}\">", conf.Name, conf.Platform); 528 ss.WriteLine(" <target name=\"{0}\" description=\"{0}|{1}\" depends=\"{0}-{1}\">", conf.Name, conf.Platform);
486 ss.WriteLine(" </target>"); 529 ss.WriteLine(" </target>");
487 ss.WriteLine(); 530 ss.WriteLine();
488 } 531 }
489 532
490 // Write out the target for the configuration. 533 // Write out the target for the configuration.
491 ss.WriteLine(" <target name=\"{0}-{1}\" description=\"{0}|{1}\">", conf.Name, conf.Platform); 534 ss.WriteLine(" <target name=\"{0}-{1}\" description=\"{0}|{1}\">", conf.Name, conf.Platform);
492 ss.WriteLine(" <property name=\"project.config\" value=\"{0}\" />", conf.Name); 535 ss.WriteLine(" <property name=\"project.config\" value=\"{0}\" />", conf.Name);
493 ss.WriteLine(" <property name=\"build.debug\" value=\"{0}\" />", conf.Options["DebugInformation"].ToString().ToLower()); 536 ss.WriteLine(" <property name=\"build.debug\" value=\"{0}\" />", conf.Options["DebugInformation"].ToString().ToLower());
494 ss.WriteLine("\t\t <property name=\"build.platform\" value=\"{0}\" />", conf.Platform); 537 ss.WriteLine("\t\t <property name=\"build.platform\" value=\"{0}\" />", conf.Platform);
495 ss.WriteLine(" </target>"); 538 ss.WriteLine(" </target>");
496 ss.WriteLine(); 539 ss.WriteLine();
497 } 540 }
498 541
499 ss.WriteLine(" <target name=\"net-1.1\" description=\"Sets framework to .NET 1.1\">"); 542 ss.WriteLine(" <target name=\"net-1.1\" description=\"Sets framework to .NET 1.1\">");
500 ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"net-1.1\" />"); 543 ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"net-1.1\" />");
501 ss.WriteLine(" </target>"); 544 ss.WriteLine(" </target>");
502 ss.WriteLine(); 545 ss.WriteLine();
503 546
504 ss.WriteLine(" <target name=\"net-2.0\" description=\"Sets framework to .NET 2.0\">"); 547 ss.WriteLine(" <target name=\"net-2.0\" description=\"Sets framework to .NET 2.0\">");
505 ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"net-2.0\" />"); 548 ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"net-2.0\" />");
506 ss.WriteLine(" </target>"); 549 ss.WriteLine(" </target>");
507 ss.WriteLine(); 550 ss.WriteLine();
508 551
509 ss.WriteLine(" <target name=\"net-3.5\" description=\"Sets framework to .NET 3.5\">"); 552 ss.WriteLine(" <target name=\"net-3.5\" description=\"Sets framework to .NET 3.5\">");
510 ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"net-3.5\" />"); 553 ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"net-3.5\" />");
511 ss.WriteLine(" </target>"); 554 ss.WriteLine(" </target>");
512 ss.WriteLine(); 555 ss.WriteLine();
513 556
514 ss.WriteLine(" <target name=\"mono-1.0\" description=\"Sets framework to mono 1.0\">"); 557 ss.WriteLine(" <target name=\"mono-1.0\" description=\"Sets framework to mono 1.0\">");
515 ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"mono-1.0\" />"); 558 ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"mono-1.0\" />");
516 ss.WriteLine(" </target>"); 559 ss.WriteLine(" </target>");
517 ss.WriteLine(); 560 ss.WriteLine();
518 561
519 ss.WriteLine(" <target name=\"mono-2.0\" description=\"Sets framework to mono 2.0\">"); 562 ss.WriteLine(" <target name=\"mono-2.0\" description=\"Sets framework to mono 2.0\">");
520 ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"mono-2.0\" />"); 563 ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"mono-2.0\" />");
521 ss.WriteLine(" </target>"); 564 ss.WriteLine(" </target>");
522 ss.WriteLine(); 565 ss.WriteLine();
523 566
524 ss.WriteLine(" <target name=\"mono-3.5\" description=\"Sets framework to mono 3.5\">"); 567 ss.WriteLine(" <target name=\"mono-3.5\" description=\"Sets framework to mono 3.5\">");
525 ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"mono-3.5\" />"); 568 ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"mono-3.5\" />");
526 ss.WriteLine(" </target>"); 569 ss.WriteLine(" </target>");
527 ss.WriteLine(); 570 ss.WriteLine();
528 571
529 ss.WriteLine(" <target name=\"init\" description=\"\">"); 572 ss.WriteLine(" <target name=\"init\" description=\"\">");
530 ss.WriteLine(" <call target=\"${project.config}\" />"); 573 ss.WriteLine(" <call target=\"${project.config}\" />");
@@ -594,24 +637,6 @@ namespace Prebuild.Core.Targets
594 ss.WriteLine(" <target name=\"clean\" description=\"\">"); 637 ss.WriteLine(" <target name=\"clean\" description=\"\">");
595 ss.WriteLine(" <echo message=\"Deleting all builds from all configurations\" />"); 638 ss.WriteLine(" <echo message=\"Deleting all builds from all configurations\" />");
596 //ss.WriteLine(" <delete dir=\"${dist.dir}\" failonerror=\"false\" />"); 639 //ss.WriteLine(" <delete dir=\"${dist.dir}\" failonerror=\"false\" />");
597
598 // justincc: FIXME FIXME FIXME - A temporary OpenSim hack to clean up files when "nant clean" is executed.
599 // Should be replaced with extreme prejudice once anybody finds out if the CleanFiles stuff works or there is
600 // another working mechanism for specifying this stuff
601 ss.WriteLine(" <delete failonerror=\"false\">");
602 ss.WriteLine(" <fileset basedir=\"${bin.dir}\">");
603 ss.WriteLine(" <include name=\"OpenSim*.dll\"/>");
604 ss.WriteLine(" <include name=\"OpenSim*.dll.mdb\"/>");
605 ss.WriteLine(" <include name=\"OpenSim*.exe\"/>");
606 ss.WriteLine(" <include name=\"OpenSim*.exe.mdb\"/>");
607 ss.WriteLine(" <include name=\"ScriptEngines/*\"/>");
608 ss.WriteLine(" <include name=\"Physics/*.dll\"/>");
609 ss.WriteLine(" <include name=\"Physics/*.dll.mdb\"/>");
610 ss.WriteLine(" <exclude name=\"OpenSim.32BitLaunch.exe\"/>");
611 ss.WriteLine(" <exclude name=\"ScriptEngines/Default.lsl\"/>");
612 ss.WriteLine(" </fileset>");
613 ss.WriteLine(" </delete>");
614
615 if (solution.Cleanup != null && solution.Cleanup.CleanFiles.Count > 0) 640 if (solution.Cleanup != null && solution.Cleanup.CleanFiles.Count > 0)
616 { 641 {
617 foreach (CleanFilesNode cleanFile in solution.Cleanup.CleanFiles) 642 foreach (CleanFilesNode cleanFile in solution.Cleanup.CleanFiles)
@@ -625,7 +650,7 @@ namespace Prebuild.Core.Targets
625 } 650 }
626 } 651 }
627 652
628 ss.WriteLine(" <delete dir=\"${obj.dir}\" failonerror=\"false\" />"); 653 ss.WriteLine(" <delete dir=\"${obj.dir}\" failonerror=\"false\" />");
629 foreach (ProjectNode project in solution.Projects) 654 foreach (ProjectNode project in solution.Projects)
630 { 655 {
631 string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); 656 string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath);
diff --git a/Prebuild/src/Core/Targets/SharpDevelop2Target.cs b/Prebuild/src/Core/Targets/SharpDevelop2Target.cs
index 40a210d..66dd1bc 100644
--- a/Prebuild/src/Core/Targets/SharpDevelop2Target.cs
+++ b/Prebuild/src/Core/Targets/SharpDevelop2Target.cs
@@ -5,16 +5,16 @@ Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehea
5Redistribution and use in source and binary forms, with or without modification, are permitted 5Redistribution and use in source and binary forms, with or without modification, are permitted
6provided that the following conditions are met: 6provided that the following conditions are met:
7 7
8* Redistributions of source code must retain the above copyright notice, this list of conditions 8* Redistributions of source code must retain the above copyright notice, this list of conditions
9 and the following disclaimer. 9 and the following disclaimer.
10* Redistributions in binary form must reproduce the above copyright notice, this list of conditions 10* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
11 and the following disclaimer in the documentation and/or other materials provided with the 11 and the following disclaimer in the documentation and/or other materials provided with the
12 distribution. 12 distribution.
13* The name of the author may not be used to endorse or promote products derived from this software 13* The name of the author may not be used to endorse or promote products derived from this software
14 without specific prior written permission. 14 without specific prior written permission.
15 15
16THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, 16THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
17BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 18ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 19EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 20OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
@@ -29,11 +29,11 @@ using Prebuild.Core.Attributes;
29 29
30namespace Prebuild.Core.Targets 30namespace Prebuild.Core.Targets
31{ 31{
32 /// <summary> 32 /// <summary>
33 /// 33 ///
34 /// </summary> 34 /// </summary>
35 [Target("sharpdev2")] 35 [Target("sharpdev2")]
36 public class SharpDevelop2Target : VS2005Target 36 public class SharpDevelop2Target : VS2005Target
37 { 37 {
38 #region Properties 38 #region Properties
39 public override string VersionName 39 public override string VersionName
@@ -45,38 +45,38 @@ namespace Prebuild.Core.Targets
45 } 45 }
46 #endregion 46 #endregion
47 47
48 #region Public Methods 48 #region Public Methods
49 49
50 /// <summary> 50 /// <summary>
51 /// Writes the specified kern. 51 /// Writes the specified kern.
52 /// </summary> 52 /// </summary>
53 /// <param name="kern">The kern.</param> 53 /// <param name="kern">The kern.</param>
54 public override void Write(Kernel kern) 54 public override void Write(Kernel kern)
55 { 55 {
56 base.Write(kern); 56 base.Write(kern);
57 } 57 }
58 58
59 /// <summary> 59 /// <summary>
60 /// Cleans the specified kern. 60 /// Cleans the specified kern.
61 /// </summary> 61 /// </summary>
62 /// <param name="kern">The kern.</param> 62 /// <param name="kern">The kern.</param>
63 public override void Clean(Kernel kern) 63 public override void Clean(Kernel kern)
64 { 64 {
65 base.Clean(kern); 65 base.Clean(kern);
66 } 66 }
67 67
68 /// <summary> 68 /// <summary>
69 /// Gets the name. 69 /// Gets the name.
70 /// </summary> 70 /// </summary>
71 /// <value>The name.</value> 71 /// <value>The name.</value>
72 public override string Name 72 public override string Name
73 { 73 {
74 get 74 get
75 { 75 {
76 return "sharpdev2"; 76 return "sharpdev2";
77 } 77 }
78 } 78 }
79 79
80 #endregion 80 #endregion
81 } 81 }
82} 82}
diff --git a/Prebuild/src/Core/Targets/SharpDevelopTarget.cs b/Prebuild/src/Core/Targets/SharpDevelopTarget.cs
index acab9f4..8e32050 100644
--- a/Prebuild/src/Core/Targets/SharpDevelopTarget.cs
+++ b/Prebuild/src/Core/Targets/SharpDevelopTarget.cs
@@ -5,16 +5,16 @@ Copyright (c) 2004 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (da
5Redistribution and use in source and binary forms, with or without modification, are permitted 5Redistribution and use in source and binary forms, with or without modification, are permitted
6provided that the following conditions are met: 6provided that the following conditions are met:
7 7
8* Redistributions of source code must retain the above copyright notice, this list of conditions 8* Redistributions of source code must retain the above copyright notice, this list of conditions
9 and the following disclaimer. 9 and the following disclaimer.
10* Redistributions in binary form must reproduce the above copyright notice, this list of conditions 10* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
11 and the following disclaimer in the documentation and/or other materials provided with the 11 and the following disclaimer in the documentation and/or other materials provided with the
12 distribution. 12 distribution.
13* The name of the author may not be used to endorse or promote products derived from this software 13* The name of the author may not be used to endorse or promote products derived from this software
14 without specific prior written permission. 14 without specific prior written permission.
15 15
16THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, 16THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
17BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 18ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 19EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 20OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
@@ -34,392 +34,392 @@ using Prebuild.Core.Utilities;
34 34
35namespace Prebuild.Core.Targets 35namespace Prebuild.Core.Targets
36{ 36{
37 /// <summary> 37 /// <summary>
38 /// 38 ///
39 /// </summary> 39 /// </summary>
40 [Target("sharpdev")] 40 [Target("sharpdev")]
41 public class SharpDevelopTarget : ITarget 41 public class SharpDevelopTarget : ITarget
42 { 42 {
43 #region Fields 43 #region Fields
44 44
45 private Kernel m_Kernel; 45 private Kernel m_Kernel;
46 46
47 #endregion 47 #endregion
48 48
49 #region Private Methods 49 #region Private Methods
50 50
51 private static string PrependPath(string path) 51 private static string PrependPath(string path)
52 { 52 {
53 string tmpPath = Helper.NormalizePath(path, '/'); 53 string tmpPath = Helper.NormalizePath(path, '/');
54 Regex regex = new Regex(@"(\w):/(\w+)"); 54 Regex regex = new Regex(@"(\w):/(\w+)");
55 Match match = regex.Match(tmpPath); 55 Match match = regex.Match(tmpPath);
56 if(match.Success || tmpPath[0] == '.' || tmpPath[0] == '/') 56 if(match.Success || tmpPath[0] == '.' || tmpPath[0] == '/')
57 { 57 {
58 tmpPath = Helper.NormalizePath(tmpPath); 58 tmpPath = Helper.NormalizePath(tmpPath);
59 } 59 }
60 else 60 else
61 { 61 {
62 tmpPath = Helper.NormalizePath("./" + tmpPath); 62 tmpPath = Helper.NormalizePath("./" + tmpPath);
63 } 63 }
64 64
65 return tmpPath; 65 return tmpPath;
66 } 66 }
67 67
68 private static string BuildReference(SolutionNode solution, ReferenceNode refr) 68 private static string BuildReference(SolutionNode solution, ReferenceNode refr)
69 { 69 {
70 string ret = "<Reference type=\""; 70 string ret = "<Reference type=\"";
71 if(solution.ProjectsTable.ContainsKey(refr.Name)) 71 if(solution.ProjectsTable.ContainsKey(refr.Name))
72 { 72 {
73 ret += "Project\" refto=\"" + refr.Name; 73 ret += "Project\" refto=\"" + refr.Name;
74 ret += "\" localcopy=\"" + refr.LocalCopy.ToString() + "\" />"; 74 ret += "\" localcopy=\"" + refr.LocalCopy.ToString() + "\" />";
75 } 75 }
76 else 76 else
77 { 77 {
78 ProjectNode project = (ProjectNode)refr.Parent; 78 ProjectNode project = (ProjectNode)refr.Parent;
79 string fileRef = FindFileReference(refr.Name, project); 79 string fileRef = FindFileReference(refr.Name, project);
80 80
81 if(refr.Path != null || fileRef != null) 81 if(refr.Path != null || fileRef != null)
82 { 82 {
83 ret += "Assembly\" refto=\""; 83 ret += "Assembly\" refto=\"";
84 84
85 string finalPath = (refr.Path != null) ? Helper.MakeFilePath(refr.Path, refr.Name, "dll") : fileRef; 85 string finalPath = (refr.Path != null) ? Helper.MakeFilePath(refr.Path, refr.Name, "dll") : fileRef;
86 86
87 ret += finalPath; 87 ret += finalPath;
88 ret += "\" localcopy=\"" + refr.LocalCopy.ToString() + "\" />"; 88 ret += "\" localcopy=\"" + refr.LocalCopy.ToString() + "\" />";
89 return ret; 89 return ret;
90 } 90 }
91 91
92 ret += "Gac\" refto=\""; 92 ret += "Gac\" refto=\"";
93 try 93 try
94 { 94 {
95 //Assembly assem = Assembly.Load(refr.Name); 95 //Assembly assem = Assembly.Load(refr.Name);
96 ret += refr.Name;// assem.FullName; 96 ret += refr.Name;// assem.FullName;
97 } 97 }
98 catch (System.NullReferenceException e) 98 catch (System.NullReferenceException e)
99 { 99 {
100 e.ToString(); 100 e.ToString();
101 ret += refr.Name; 101 ret += refr.Name;
102 } 102 }
103 ret += "\" localcopy=\"" + refr.LocalCopy.ToString() + "\" />"; 103 ret += "\" localcopy=\"" + refr.LocalCopy.ToString() + "\" />";
104 } 104 }
105 105
106 return ret; 106 return ret;
107 } 107 }
108 108
109 private static string FindFileReference(string refName, ProjectNode project) 109 private static string FindFileReference(string refName, ProjectNode project)
110 { 110 {
111 foreach(ReferencePathNode refPath in project.ReferencePaths) 111 foreach(ReferencePathNode refPath in project.ReferencePaths)
112 { 112 {
113 string fullPath = Helper.MakeFilePath(refPath.Path, refName, "dll"); 113 string fullPath = Helper.MakeFilePath(refPath.Path, refName, "dll");
114 114
115 if(File.Exists(fullPath)) 115 if(File.Exists(fullPath))
116 { 116 {
117 return fullPath; 117 return fullPath;
118 } 118 }
119 } 119 }
120 120
121 return null; 121 return null;
122 } 122 }
123 123
124 /// <summary> 124 /// <summary>
125 /// Gets the XML doc file. 125 /// Gets the XML doc file.
126 /// </summary> 126 /// </summary>
127 /// <param name="project">The project.</param> 127 /// <param name="project">The project.</param>
128 /// <param name="conf">The conf.</param> 128 /// <param name="conf">The conf.</param>
129 /// <returns></returns> 129 /// <returns></returns>
130 public static string GenerateXmlDocFile(ProjectNode project, ConfigurationNode conf) 130 public static string GenerateXmlDocFile(ProjectNode project, ConfigurationNode conf)
131 { 131 {
132 if( conf == null ) 132 if( conf == null )
133 { 133 {
134 throw new ArgumentNullException("conf"); 134 throw new ArgumentNullException("conf");
135 } 135 }
136 if( project == null ) 136 if( project == null )
137 { 137 {
138 throw new ArgumentNullException("project"); 138 throw new ArgumentNullException("project");
139 } 139 }
140 string docFile = (string)conf.Options["XmlDocFile"]; 140 string docFile = (string)conf.Options["XmlDocFile"];
141 if(docFile != null && docFile.Length == 0)//default to assembly name if not specified 141 if(docFile != null && docFile.Length == 0)//default to assembly name if not specified
142 { 142 {
143 return "False"; 143 return "False";
144 } 144 }
145 return "True"; 145 return "True";
146 } 146 }
147 147
148 private void WriteProject(SolutionNode solution, ProjectNode project) 148 private void WriteProject(SolutionNode solution, ProjectNode project)
149 { 149 {
150 string csComp = "Csc"; 150 string csComp = "Csc";
151 string netRuntime = "MsNet"; 151 string netRuntime = "MsNet";
152 if(project.Runtime == ClrRuntime.Mono) 152 if(project.Runtime == ClrRuntime.Mono)
153 { 153 {
154 csComp = "Mcs"; 154 csComp = "Mcs";
155 netRuntime = "Mono"; 155 netRuntime = "Mono";
156 } 156 }
157 157
158 string projFile = Helper.MakeFilePath(project.FullPath, project.Name, "prjx"); 158 string projFile = Helper.MakeFilePath(project.FullPath, project.Name, "prjx");
159 StreamWriter ss = new StreamWriter(projFile); 159 StreamWriter ss = new StreamWriter(projFile);
160 160
161 m_Kernel.CurrentWorkingDirectory.Push(); 161 m_Kernel.CurrentWorkingDirectory.Push();
162 Helper.SetCurrentDir(Path.GetDirectoryName(projFile)); 162 Helper.SetCurrentDir(Path.GetDirectoryName(projFile));
163 163
164 using(ss) 164 using(ss)
165 { 165 {
166 ss.WriteLine( 166 ss.WriteLine(
167 "<Project name=\"{0}\" standardNamespace=\"{1}\" description=\"\" newfilesearch=\"None\" enableviewstate=\"True\" version=\"1.1\" projecttype=\"C#\">", 167 "<Project name=\"{0}\" standardNamespace=\"{1}\" description=\"\" newfilesearch=\"None\" enableviewstate=\"True\" version=\"1.1\" projecttype=\"C#\">",
168 project.Name, 168 project.Name,
169 project.RootNamespace 169 project.RootNamespace
170 ); 170 );
171 171
172 ss.WriteLine(" <Contents>"); 172 ss.WriteLine(" <Contents>");
173 foreach(string file in project.Files) 173 foreach(string file in project.Files)
174 { 174 {
175 string buildAction = "Compile"; 175 string buildAction = "Compile";
176 switch(project.Files.GetBuildAction(file)) 176 switch(project.Files.GetBuildAction(file))
177 { 177 {
178 case BuildAction.None: 178 case BuildAction.None:
179 buildAction = "Nothing"; 179 buildAction = "Nothing";
180 break; 180 break;
181 181
182 case BuildAction.Content: 182 case BuildAction.Content:
183 buildAction = "Exclude"; 183 buildAction = "Exclude";
184 break; 184 break;
185 185
186 case BuildAction.EmbeddedResource: 186 case BuildAction.EmbeddedResource:
187 buildAction = "EmbedAsResource"; 187 buildAction = "EmbedAsResource";
188 break; 188 break;
189 189
190 default: 190 default:
191 buildAction = "Compile"; 191 buildAction = "Compile";
192 break; 192 break;
193 } 193 }
194 194
195 // Sort of a hack, we try and resolve the path and make it relative, if we can. 195 // Sort of a hack, we try and resolve the path and make it relative, if we can.
196 string filePath = PrependPath(file); 196 string filePath = PrependPath(file);
197 ss.WriteLine(" <File name=\"{0}\" subtype=\"Code\" buildaction=\"{1}\" dependson=\"\" data=\"\" />", filePath, buildAction); 197 ss.WriteLine(" <File name=\"{0}\" subtype=\"Code\" buildaction=\"{1}\" dependson=\"\" data=\"\" />", filePath, buildAction);
198 } 198 }
199 ss.WriteLine(" </Contents>"); 199 ss.WriteLine(" </Contents>");
200 200
201 ss.WriteLine(" <References>"); 201 ss.WriteLine(" <References>");
202 foreach(ReferenceNode refr in project.References) 202 foreach(ReferenceNode refr in project.References)
203 { 203 {
204 ss.WriteLine(" {0}", BuildReference(solution, refr)); 204 ss.WriteLine(" {0}", BuildReference(solution, refr));
205 } 205 }
206 ss.WriteLine(" </References>"); 206 ss.WriteLine(" </References>");
207 207
208 ss.Write(" <DeploymentInformation"); 208 ss.Write(" <DeploymentInformation");
209 ss.Write(" target=\"\""); 209 ss.Write(" target=\"\"");
210 ss.Write(" script=\"\""); 210 ss.Write(" script=\"\"");
211 ss.Write(" strategy=\"File\""); 211 ss.Write(" strategy=\"File\"");
212 ss.WriteLine(" />"); 212 ss.WriteLine(" />");
213 213
214 int count = 0; 214 int count = 0;
215 215
216 ss.WriteLine(" <Configurations active=\"{0}\">", solution.ActiveConfig); 216 ss.WriteLine(" <Configurations active=\"{0}\">", solution.ActiveConfig);
217 217
218 foreach(ConfigurationNode conf in project.Configurations) 218 foreach(ConfigurationNode conf in project.Configurations)
219 { 219 {
220 ss.Write(" <Configuration"); 220 ss.Write(" <Configuration");
221 ss.Write(" runwithwarnings=\"True\""); 221 ss.Write(" runwithwarnings=\"True\"");
222 ss.Write(" name=\"{0}\"", conf.Name); 222 ss.Write(" name=\"{0}\"", conf.Name);
223 ss.WriteLine(">"); 223 ss.WriteLine(">");
224 ss.Write(" <CodeGeneration"); 224 ss.Write(" <CodeGeneration");
225 ss.Write(" runtime=\"{0}\"", netRuntime); 225 ss.Write(" runtime=\"{0}\"", netRuntime);
226 ss.Write(" compiler=\"{0}\"", csComp); 226 ss.Write(" compiler=\"{0}\"", csComp);
227 ss.Write(" compilerversion=\"\""); 227 ss.Write(" compilerversion=\"\"");
228 ss.Write(" warninglevel=\"{0}\"", conf.Options["WarningLevel"]); 228 ss.Write(" warninglevel=\"{0}\"", conf.Options["WarningLevel"]);
229 ss.Write(" nowarn=\"{0}\"", conf.Options["SuppressWarnings"]); 229 ss.Write(" nowarn=\"{0}\"", conf.Options["SuppressWarnings"]);
230 ss.Write(" includedebuginformation=\"{0}\"", conf.Options["DebugInformation"]); 230 ss.Write(" includedebuginformation=\"{0}\"", conf.Options["DebugInformation"]);
231 ss.Write(" optimize=\"{0}\"", conf.Options["OptimizeCode"]); 231 ss.Write(" optimize=\"{0}\"", conf.Options["OptimizeCode"]);
232 ss.Write(" unsafecodeallowed=\"{0}\"", conf.Options["AllowUnsafe"]); 232 ss.Write(" unsafecodeallowed=\"{0}\"", conf.Options["AllowUnsafe"]);
233 ss.Write(" generateoverflowchecks=\"{0}\"", conf.Options["CheckUnderflowOverflow"]); 233 ss.Write(" generateoverflowchecks=\"{0}\"", conf.Options["CheckUnderflowOverflow"]);
234 ss.Write(" mainclass=\"{0}\"", project.StartupObject); 234 ss.Write(" mainclass=\"{0}\"", project.StartupObject);
235 ss.Write(" target=\"{0}\"", project.Type); 235 ss.Write(" target=\"{0}\"", project.Type);
236 ss.Write(" definesymbols=\"{0}\"", conf.Options["CompilerDefines"]); 236 ss.Write(" definesymbols=\"{0}\"", conf.Options["CompilerDefines"]);
237 ss.Write(" generatexmldocumentation=\"{0}\"", GenerateXmlDocFile(project, conf)); 237 ss.Write(" generatexmldocumentation=\"{0}\"", GenerateXmlDocFile(project, conf));
238 ss.Write(" win32Icon=\"{0}\"", Helper.NormalizePath(".\\" + project.AppIcon)); 238 ss.Write(" win32Icon=\"{0}\"", Helper.NormalizePath(".\\" + project.AppIcon));
239 ss.Write(" noconfig=\"{0}\"", "False"); 239 ss.Write(" noconfig=\"{0}\"", "False");
240 ss.Write(" nostdlib=\"{0}\"", conf.Options["NoStdLib"]); 240 ss.Write(" nostdlib=\"{0}\"", conf.Options["NoStdLib"]);
241 ss.WriteLine(" />"); 241 ss.WriteLine(" />");
242 242
243 ss.Write(" <Execution"); 243 ss.Write(" <Execution");
244 ss.Write(" commandlineparameters=\"\""); 244 ss.Write(" commandlineparameters=\"\"");
245 ss.Write(" consolepause=\"True\""); 245 ss.Write(" consolepause=\"True\"");
246 ss.WriteLine(" />"); 246 ss.WriteLine(" />");
247 247
248 ss.Write(" <Output"); 248 ss.Write(" <Output");
249 ss.Write(" directory=\".\\{0}\"", Helper.NormalizePath(conf.Options["OutputPath"].ToString())); 249 ss.Write(" directory=\".\\{0}\"", Helper.NormalizePath(conf.Options["OutputPath"].ToString()));
250 ss.Write(" assembly=\"{0}\"", project.AssemblyName); 250 ss.Write(" assembly=\"{0}\"", project.AssemblyName);
251 ss.Write(" executeScript=\"{0}\"", conf.Options["RunScript"]); 251 ss.Write(" executeScript=\"{0}\"", conf.Options["RunScript"]);
252 if (conf.Options["PreBuildEvent"] != null && conf.Options["PreBuildEvent"].ToString().Length != 0) 252 if (conf.Options["PreBuildEvent"] != null && conf.Options["PreBuildEvent"].ToString().Length != 0)
253 { 253 {
254 ss.Write(" executeBeforeBuild=\"{0}\"", Helper.NormalizePath(conf.Options["PreBuildEvent"].ToString())); 254 ss.Write(" executeBeforeBuild=\"{0}\"", Helper.NormalizePath(conf.Options["PreBuildEvent"].ToString()));
255 } 255 }
256 else 256 else
257 { 257 {
258 ss.Write(" executeBeforeBuild=\"{0}\"", conf.Options["PreBuildEvent"]); 258 ss.Write(" executeBeforeBuild=\"{0}\"", conf.Options["PreBuildEvent"]);
259 } 259 }
260 if (conf.Options["PostBuildEvent"] != null && conf.Options["PostBuildEvent"].ToString().Length != 0) 260 if (conf.Options["PostBuildEvent"] != null && conf.Options["PostBuildEvent"].ToString().Length != 0)
261 { 261 {
262 ss.Write(" executeAfterBuild=\"{0}\"", Helper.NormalizePath(conf.Options["PostBuildEvent"].ToString())); 262 ss.Write(" executeAfterBuild=\"{0}\"", Helper.NormalizePath(conf.Options["PostBuildEvent"].ToString()));
263 } 263 }
264 else 264 else
265 { 265 {
266 ss.Write(" executeAfterBuild=\"{0}\"", conf.Options["PostBuildEvent"]); 266 ss.Write(" executeAfterBuild=\"{0}\"", conf.Options["PostBuildEvent"]);
267 } 267 }
268 ss.Write(" executeBeforeBuildArguments=\"{0}\"", conf.Options["PreBuildEventArgs"]); 268 ss.Write(" executeBeforeBuildArguments=\"{0}\"", conf.Options["PreBuildEventArgs"]);
269 ss.Write(" executeAfterBuildArguments=\"{0}\"", conf.Options["PreBuildEventArgs"]); 269 ss.Write(" executeAfterBuildArguments=\"{0}\"", conf.Options["PreBuildEventArgs"]);
270 ss.WriteLine(" />"); 270 ss.WriteLine(" />");
271 ss.WriteLine(" </Configuration>"); 271 ss.WriteLine(" </Configuration>");
272 272
273 count++; 273 count++;
274 } 274 }
275 ss.WriteLine(" </Configurations>"); 275 ss.WriteLine(" </Configurations>");
276 ss.WriteLine("</Project>"); 276 ss.WriteLine("</Project>");
277 } 277 }
278 278
279 m_Kernel.CurrentWorkingDirectory.Pop(); 279 m_Kernel.CurrentWorkingDirectory.Pop();
280 } 280 }
281 281
282 private void WriteCombine(SolutionNode solution) 282 private void WriteCombine(SolutionNode solution)
283 { 283 {
284 m_Kernel.Log.Write("Creating SharpDevelop combine and project files"); 284 m_Kernel.Log.Write("Creating SharpDevelop combine and project files");
285 foreach(ProjectNode project in solution.Projects) 285 foreach(ProjectNode project in solution.Projects)
286 { 286 {
287 if(m_Kernel.AllowProject(project.FilterGroups)) 287 if(m_Kernel.AllowProject(project.FilterGroups))
288 { 288 {
289 m_Kernel.Log.Write("...Creating project: {0}", project.Name); 289 m_Kernel.Log.Write("...Creating project: {0}", project.Name);
290 WriteProject(solution, project); 290 WriteProject(solution, project);
291 } 291 }
292 } 292 }
293 293
294 m_Kernel.Log.Write(""); 294 m_Kernel.Log.Write("");
295 string combFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "cmbx"); 295 string combFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "cmbx");
296 StreamWriter ss = new StreamWriter(combFile); 296 StreamWriter ss = new StreamWriter(combFile);
297 297
298 m_Kernel.CurrentWorkingDirectory.Push(); 298 m_Kernel.CurrentWorkingDirectory.Push();
299 Helper.SetCurrentDir(Path.GetDirectoryName(combFile)); 299 Helper.SetCurrentDir(Path.GetDirectoryName(combFile));
300 300
301 using(ss) 301 using(ss)
302 { 302 {
303 ss.WriteLine("<Combine fileversion=\"1.0\" name=\"{0}\" description=\"\">", solution.Name); 303 ss.WriteLine("<Combine fileversion=\"1.0\" name=\"{0}\" description=\"\">", solution.Name);
304 304
305 int count = 0; 305 int count = 0;
306 foreach(ProjectNode project in solution.Projects) 306 foreach(ProjectNode project in solution.Projects)
307 { 307 {
308 if(count == 0) 308 if(count == 0)
309 ss.WriteLine(" <StartMode startupentry=\"{0}\" single=\"True\">", project.Name); 309 ss.WriteLine(" <StartMode startupentry=\"{0}\" single=\"True\">", project.Name);
310 310
311 ss.WriteLine(" <Execute entry=\"{0}\" type=\"None\" />", project.Name); 311 ss.WriteLine(" <Execute entry=\"{0}\" type=\"None\" />", project.Name);
312 count++; 312 count++;
313 } 313 }
314 ss.WriteLine(" </StartMode>"); 314 ss.WriteLine(" </StartMode>");
315 315
316 ss.WriteLine(" <Entries>"); 316 ss.WriteLine(" <Entries>");
317 foreach(ProjectNode project in solution.Projects) 317 foreach(ProjectNode project in solution.Projects)
318 { 318 {
319 string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); 319 string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath);
320 ss.WriteLine(" <Entry filename=\"{0}\" />", 320 ss.WriteLine(" <Entry filename=\"{0}\" />",
321 Helper.MakeFilePath(path, project.Name, "prjx")); 321 Helper.MakeFilePath(path, project.Name, "prjx"));
322 } 322 }
323 ss.WriteLine(" </Entries>"); 323 ss.WriteLine(" </Entries>");
324 324
325 count = 0; 325 count = 0;
326 foreach(ConfigurationNode conf in solution.Configurations) 326 foreach(ConfigurationNode conf in solution.Configurations)
327 { 327 {
328 if(count == 0) 328 if(count == 0)
329 { 329 {
330 ss.WriteLine(" <Configurations active=\"{0}\">", conf.Name); 330 ss.WriteLine(" <Configurations active=\"{0}\">", conf.Name);
331 } 331 }
332 332
333 ss.WriteLine(" <Configuration name=\"{0}\">", conf.Name); 333 ss.WriteLine(" <Configuration name=\"{0}\">", conf.Name);
334 foreach(ProjectNode project in solution.Projects) 334 foreach(ProjectNode project in solution.Projects)
335 { 335 {
336 ss.WriteLine(" <Entry name=\"{0}\" configurationname=\"{1}\" build=\"True\" />", project.Name, conf.Name); 336 ss.WriteLine(" <Entry name=\"{0}\" configurationname=\"{1}\" build=\"True\" />", project.Name, conf.Name);
337 } 337 }
338 ss.WriteLine(" </Configuration>"); 338 ss.WriteLine(" </Configuration>");
339 339
340 count++; 340 count++;
341 } 341 }
342 ss.WriteLine(" </Configurations>"); 342 ss.WriteLine(" </Configurations>");
343 ss.WriteLine("</Combine>"); 343 ss.WriteLine("</Combine>");
344 } 344 }
345 345
346 m_Kernel.CurrentWorkingDirectory.Pop(); 346 m_Kernel.CurrentWorkingDirectory.Pop();
347 } 347 }
348 348
349 private void CleanProject(ProjectNode project) 349 private void CleanProject(ProjectNode project)
350 { 350 {
351 m_Kernel.Log.Write("...Cleaning project: {0}", project.Name); 351 m_Kernel.Log.Write("...Cleaning project: {0}", project.Name);
352 string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, "prjx"); 352 string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, "prjx");
353 Helper.DeleteIfExists(projectFile); 353 Helper.DeleteIfExists(projectFile);
354 } 354 }
355 355
356 private void CleanSolution(SolutionNode solution) 356 private void CleanSolution(SolutionNode solution)
357 { 357 {
358 m_Kernel.Log.Write("Cleaning SharpDevelop combine and project files for", solution.Name); 358 m_Kernel.Log.Write("Cleaning SharpDevelop combine and project files for", solution.Name);
359 359
360 string slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "cmbx"); 360 string slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "cmbx");
361 Helper.DeleteIfExists(slnFile); 361 Helper.DeleteIfExists(slnFile);
362 362
363 foreach(ProjectNode project in solution.Projects) 363 foreach(ProjectNode project in solution.Projects)
364 { 364 {
365 CleanProject(project); 365 CleanProject(project);
366 } 366 }
367 367
368 m_Kernel.Log.Write(""); 368 m_Kernel.Log.Write("");
369 } 369 }
370 370
371 #endregion 371 #endregion
372 372
373 #region ITarget Members 373 #region ITarget Members
374 374
375 /// <summary> 375 /// <summary>
376 /// Writes the specified kern. 376 /// Writes the specified kern.
377 /// </summary> 377 /// </summary>
378 /// <param name="kern">The kern.</param> 378 /// <param name="kern">The kern.</param>
379 public void Write(Kernel kern) 379 public void Write(Kernel kern)
380 { 380 {
381 if( kern == null ) 381 if( kern == null )
382 { 382 {
383 throw new ArgumentNullException("kern"); 383 throw new ArgumentNullException("kern");
384 } 384 }
385 m_Kernel = kern; 385 m_Kernel = kern;
386 foreach(SolutionNode solution in kern.Solutions) 386 foreach(SolutionNode solution in kern.Solutions)
387 { 387 {
388 WriteCombine(solution); 388 WriteCombine(solution);
389 } 389 }
390 m_Kernel = null; 390 m_Kernel = null;
391 } 391 }
392 392
393 /// <summary> 393 /// <summary>
394 /// Cleans the specified kern. 394 /// Cleans the specified kern.
395 /// </summary> 395 /// </summary>
396 /// <param name="kern">The kern.</param> 396 /// <param name="kern">The kern.</param>
397 public virtual void Clean(Kernel kern) 397 public virtual void Clean(Kernel kern)
398 { 398 {
399 if( kern == null ) 399 if( kern == null )
400 { 400 {
401 throw new ArgumentNullException("kern"); 401 throw new ArgumentNullException("kern");
402 } 402 }
403 m_Kernel = kern; 403 m_Kernel = kern;
404 foreach(SolutionNode sol in kern.Solutions) 404 foreach(SolutionNode sol in kern.Solutions)
405 { 405 {
406 CleanSolution(sol); 406 CleanSolution(sol);
407 } 407 }
408 m_Kernel = null; 408 m_Kernel = null;
409 } 409 }
410 410
411 /// <summary> 411 /// <summary>
412 /// Gets the name. 412 /// Gets the name.
413 /// </summary> 413 /// </summary>
414 /// <value>The name.</value> 414 /// <value>The name.</value>
415 public string Name 415 public string Name
416 { 416 {
417 get 417 get
418 { 418 {
419 return "sharpdev"; 419 return "sharpdev";
420 } 420 }
421 } 421 }
422 422
423 #endregion 423 #endregion
424 } 424 }
425} 425}
diff --git a/Prebuild/src/Core/Targets/ToolInfo.cs b/Prebuild/src/Core/Targets/ToolInfo.cs
index 984d20e..935c674 100644
--- a/Prebuild/src/Core/Targets/ToolInfo.cs
+++ b/Prebuild/src/Core/Targets/ToolInfo.cs
@@ -4,194 +4,194 @@ using System.Text;
4 4
5namespace Prebuild.Core.Targets 5namespace Prebuild.Core.Targets
6{ 6{
7 /// <summary> 7 /// <summary>
8 /// 8 ///
9 /// </summary> 9 /// </summary>
10 public struct ToolInfo 10 public struct ToolInfo
11 { 11 {
12 string name; 12 string name;
13 string guid; 13 string guid;
14 string fileExtension; 14 string fileExtension;
15 string xmlTag; 15 string xmlTag;
16 string importProject; 16 string importProject;
17 17
18 /// <summary> 18 /// <summary>
19 /// Gets or sets the name. 19 /// Gets or sets the name.
20 /// </summary> 20 /// </summary>
21 /// <value>The name.</value> 21 /// <value>The name.</value>
22 public string Name 22 public string Name
23 { 23 {
24 get 24 get
25 { 25 {
26 return name; 26 return name;
27 } 27 }
28 set 28 set
29 { 29 {
30 name = value; 30 name = value;
31 } 31 }
32 } 32 }
33 33
34 /// <summary> 34 /// <summary>
35 /// Gets or sets the GUID. 35 /// Gets or sets the GUID.
36 /// </summary> 36 /// </summary>
37 /// <value>The GUID.</value> 37 /// <value>The GUID.</value>
38 public string Guid 38 public string Guid
39 { 39 {
40 get 40 get
41 { 41 {
42 return guid; 42 return guid;
43 } 43 }
44 set 44 set
45 { 45 {
46 guid = value; 46 guid = value;
47 } 47 }
48 } 48 }
49 49
50 /// <summary> 50 /// <summary>
51 /// Gets or sets the file extension. 51 /// Gets or sets the file extension.
52 /// </summary> 52 /// </summary>
53 /// <value>The file extension.</value> 53 /// <value>The file extension.</value>
54 public string FileExtension 54 public string FileExtension
55 { 55 {
56 get 56 get
57 { 57 {
58 return fileExtension; 58 return fileExtension;
59 } 59 }
60 set 60 set
61 { 61 {
62 fileExtension = value; 62 fileExtension = value;
63 } 63 }
64 } 64 }
65 public string LanguageExtension 65 public string LanguageExtension
66 { 66 {
67 get 67 get
68 { 68 {
69 switch (this.Name) 69 switch (this.Name)
70 { 70 {
71 case "C#": 71 case "C#":
72 return ".cs"; 72 return ".cs";
73 case "VisualBasic": 73 case "VisualBasic":
74 return ".vb"; 74 return ".vb";
75 case "Boo": 75 case "Boo":
76 return ".boo"; 76 return ".boo";
77 default: 77 default:
78 return ".cs"; 78 return ".cs";
79 } 79 }
80 } 80 }
81 } 81 }
82 /// <summary> 82 /// <summary>
83 /// Gets or sets the XML tag. 83 /// Gets or sets the XML tag.
84 /// </summary> 84 /// </summary>
85 /// <value>The XML tag.</value> 85 /// <value>The XML tag.</value>
86 public string XmlTag 86 public string XmlTag
87 { 87 {
88 get 88 get
89 { 89 {
90 return xmlTag; 90 return xmlTag;
91 } 91 }
92 set 92 set
93 { 93 {
94 xmlTag = value; 94 xmlTag = value;
95 } 95 }
96 } 96 }
97 97
98 /// <summary> 98 /// <summary>
99 /// Gets or sets the import project property. 99 /// Gets or sets the import project property.
100 /// </summary> 100 /// </summary>
101 /// <value>The ImportProject tag.</value> 101 /// <value>The ImportProject tag.</value>
102 public string ImportProject 102 public string ImportProject
103 { 103 {
104 get 104 get
105 { 105 {
106 return importProject; 106 return importProject;
107 } 107 }
108 set 108 set
109 { 109 {
110 importProject = value; 110 importProject = value;
111 } 111 }
112 } 112 }
113 113
114 /// <summary> 114 /// <summary>
115 /// Initializes a new instance of the <see cref="ToolInfo"/> class. 115 /// Initializes a new instance of the <see cref="ToolInfo"/> class.
116 /// </summary> 116 /// </summary>
117 /// <param name="name">The name.</param> 117 /// <param name="name">The name.</param>
118 /// <param name="guid">The GUID.</param> 118 /// <param name="guid">The GUID.</param>
119 /// <param name="fileExtension">The file extension.</param> 119 /// <param name="fileExtension">The file extension.</param>
120 /// <param name="xml">The XML.</param> 120 /// <param name="xml">The XML.</param>
121 /// <param name="importProject">The import project.</param> 121 /// <param name="importProject">The import project.</param>
122 public ToolInfo(string name, string guid, string fileExtension, string xml, string importProject) 122 public ToolInfo(string name, string guid, string fileExtension, string xml, string importProject)
123 { 123 {
124 this.name = name; 124 this.name = name;
125 this.guid = guid; 125 this.guid = guid;
126 this.fileExtension = fileExtension; 126 this.fileExtension = fileExtension;
127 this.xmlTag = xml; 127 this.xmlTag = xml;
128 this.importProject = importProject; 128 this.importProject = importProject;
129 } 129 }
130 130
131 /// <summary> 131 /// <summary>
132 /// Initializes a new instance of the <see cref="ToolInfo"/> class. 132 /// Initializes a new instance of the <see cref="ToolInfo"/> class.
133 /// </summary> 133 /// </summary>
134 /// <param name="name">The name.</param> 134 /// <param name="name">The name.</param>
135 /// <param name="guid">The GUID.</param> 135 /// <param name="guid">The GUID.</param>
136 /// <param name="fileExtension">The file extension.</param> 136 /// <param name="fileExtension">The file extension.</param>
137 /// <param name="xml">The XML.</param> 137 /// <param name="xml">The XML.</param>
138 public ToolInfo(string name, string guid, string fileExtension, string xml) 138 public ToolInfo(string name, string guid, string fileExtension, string xml)
139 { 139 {
140 this.name = name; 140 this.name = name;
141 this.guid = guid; 141 this.guid = guid;
142 this.fileExtension = fileExtension; 142 this.fileExtension = fileExtension;
143 this.xmlTag = xml; 143 this.xmlTag = xml;
144 this.importProject = "$(MSBuildBinPath)\\Microsoft." + xml + ".Targets"; 144 this.importProject = "$(MSBuildBinPath)\\Microsoft." + xml + ".Targets";
145 } 145 }
146 146
147 /// <summary> 147 /// <summary>
148 /// Equals operator 148 /// Equals operator
149 /// </summary> 149 /// </summary>
150 /// <param name="obj">ToolInfo to compare</param> 150 /// <param name="obj">ToolInfo to compare</param>
151 /// <returns>true if toolInfos are equal</returns> 151 /// <returns>true if toolInfos are equal</returns>
152 public override bool Equals(object obj) 152 public override bool Equals(object obj)
153 { 153 {
154 if (obj == null) 154 if (obj == null)
155 { 155 {
156 throw new ArgumentNullException("obj"); 156 throw new ArgumentNullException("obj");
157 } 157 }
158 if (obj.GetType() != typeof(ToolInfo)) 158 if (obj.GetType() != typeof(ToolInfo))
159 return false; 159 return false;
160 160
161 ToolInfo c = (ToolInfo)obj; 161 ToolInfo c = (ToolInfo)obj;
162 return ((this.name == c.name) && (this.guid == c.guid) && (this.fileExtension == c.fileExtension) && (this.importProject == c.importProject)); 162 return ((this.name == c.name) && (this.guid == c.guid) && (this.fileExtension == c.fileExtension) && (this.importProject == c.importProject));
163 } 163 }
164 164
165 /// <summary> 165 /// <summary>
166 /// Equals operator 166 /// Equals operator
167 /// </summary> 167 /// </summary>
168 /// <param name="c1">ToolInfo to compare</param> 168 /// <param name="c1">ToolInfo to compare</param>
169 /// <param name="c2">ToolInfo to compare</param> 169 /// <param name="c2">ToolInfo to compare</param>
170 /// <returns>True if toolInfos are equal</returns> 170 /// <returns>True if toolInfos are equal</returns>
171 public static bool operator ==(ToolInfo c1, ToolInfo c2) 171 public static bool operator ==(ToolInfo c1, ToolInfo c2)
172 { 172 {
173 return ((c1.name == c2.name) && (c1.guid == c2.guid) && (c1.fileExtension == c2.fileExtension) && (c1.importProject == c2.importProject) && (c1.xmlTag == c2.xmlTag)); 173 return ((c1.name == c2.name) && (c1.guid == c2.guid) && (c1.fileExtension == c2.fileExtension) && (c1.importProject == c2.importProject) && (c1.xmlTag == c2.xmlTag));
174 } 174 }
175 175
176 /// <summary> 176 /// <summary>
177 /// Not equals operator 177 /// Not equals operator
178 /// </summary> 178 /// </summary>
179 /// <param name="c1">ToolInfo to compare</param> 179 /// <param name="c1">ToolInfo to compare</param>
180 /// <param name="c2">ToolInfo to compare</param> 180 /// <param name="c2">ToolInfo to compare</param>
181 /// <returns>True if toolInfos are not equal</returns> 181 /// <returns>True if toolInfos are not equal</returns>
182 public static bool operator !=(ToolInfo c1, ToolInfo c2) 182 public static bool operator !=(ToolInfo c1, ToolInfo c2)
183 { 183 {
184 return !(c1 == c2); 184 return !(c1 == c2);
185 } 185 }
186 186
187 /// <summary> 187 /// <summary>
188 /// Hash Code 188 /// Hash Code
189 /// </summary> 189 /// </summary>
190 /// <returns>Hash code</returns> 190 /// <returns>Hash code</returns>
191 public override int GetHashCode() 191 public override int GetHashCode()
192 { 192 {
193 return name.GetHashCode() ^ guid.GetHashCode() ^ this.fileExtension.GetHashCode() ^ this.importProject.GetHashCode() ^ this.xmlTag.GetHashCode(); 193 return name.GetHashCode() ^ guid.GetHashCode() ^ this.fileExtension.GetHashCode() ^ this.importProject.GetHashCode() ^ this.xmlTag.GetHashCode();
194 194
195 } 195 }
196 } 196 }
197} 197}
diff --git a/Prebuild/src/Core/Targets/VS2002Target.cs b/Prebuild/src/Core/Targets/VS2002Target.cs
index d7f6dd1..2292624 100644
--- a/Prebuild/src/Core/Targets/VS2002Target.cs
+++ b/Prebuild/src/Core/Targets/VS2002Target.cs
@@ -5,16 +5,16 @@ Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehea
5Redistribution and use in source and binary forms, with or without modification, are permitted 5Redistribution and use in source and binary forms, with or without modification, are permitted
6provided that the following conditions are met: 6provided that the following conditions are met:
7 7
8* Redistributions of source code must retain the above copyright notice, this list of conditions 8* Redistributions of source code must retain the above copyright notice, this list of conditions
9 and the following disclaimer. 9 and the following disclaimer.
10* Redistributions in binary form must reproduce the above copyright notice, this list of conditions 10* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
11 and the following disclaimer in the documentation and/or other materials provided with the 11 and the following disclaimer in the documentation and/or other materials provided with the
12 distribution. 12 distribution.
13* The name of the author may not be used to endorse or promote products derived from this software 13* The name of the author may not be used to endorse or promote products derived from this software
14 without specific prior written permission. 14 without specific prior written permission.
15 15
16THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, 16THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
17BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 18ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 19EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 20OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
@@ -29,59 +29,59 @@ using Prebuild.Core.Attributes;
29 29
30namespace Prebuild.Core.Targets 30namespace Prebuild.Core.Targets
31{ 31{
32 /// <summary> 32 /// <summary>
33 /// 33 ///
34 /// </summary> 34 /// </summary>
35 [Target("vs2002")] 35 [Target("vs2002")]
36 public class VS2002Target : VS2003Target 36 public class VS2002Target : VS2003Target
37 { 37 {
38 #region Private Methods 38 #region Private Methods
39 39
40 private void SetVS2002() 40 private void SetVS2002()
41 { 41 {
42 this.SolutionVersion = "7.00"; 42 this.SolutionVersion = "7.00";
43 this.ProductVersion = "7.0.9254"; 43 this.ProductVersion = "7.0.9254";
44 this.SchemaVersion = "1.0"; 44 this.SchemaVersion = "1.0";
45 this.VersionName = "2002"; 45 this.VersionName = "2002";
46 this.Version = VSVersion.VS70; 46 this.Version = VSVersion.VS70;
47 } 47 }
48 48
49 #endregion 49 #endregion
50 50
51 #region Public Methods 51 #region Public Methods
52 52
53 /// <summary> 53 /// <summary>
54 /// Writes the specified kern. 54 /// Writes the specified kern.
55 /// </summary> 55 /// </summary>
56 /// <param name="kern">The kern.</param> 56 /// <param name="kern">The kern.</param>
57 public override void Write(Kernel kern) 57 public override void Write(Kernel kern)
58 { 58 {
59 SetVS2002(); 59 SetVS2002();
60 base.Write(kern); 60 base.Write(kern);
61 } 61 }
62 62
63 /// <summary> 63 /// <summary>
64 /// Cleans the specified kern. 64 /// Cleans the specified kern.
65 /// </summary> 65 /// </summary>
66 /// <param name="kern">The kern.</param> 66 /// <param name="kern">The kern.</param>
67 public override void Clean(Kernel kern) 67 public override void Clean(Kernel kern)
68 { 68 {
69 SetVS2002(); 69 SetVS2002();
70 base.Clean(kern); 70 base.Clean(kern);
71 } 71 }
72 72
73 /// <summary> 73 /// <summary>
74 /// Gets the name. 74 /// Gets the name.
75 /// </summary> 75 /// </summary>
76 /// <value>The name.</value> 76 /// <value>The name.</value>
77 public override string Name 77 public override string Name
78 { 78 {
79 get 79 get
80 { 80 {
81 return "vs2002"; 81 return "vs2002";
82 } 82 }
83 } 83 }
84 84
85 #endregion 85 #endregion
86 } 86 }
87} 87}
diff --git a/Prebuild/src/Core/Targets/VS2003Target.cs b/Prebuild/src/Core/Targets/VS2003Target.cs
index f4b4517..10e2dc4 100644
--- a/Prebuild/src/Core/Targets/VS2003Target.cs
+++ b/Prebuild/src/Core/Targets/VS2003Target.cs
@@ -5,16 +5,16 @@ Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehea
5Redistribution and use in source and binary forms, with or without modification, are permitted 5Redistribution and use in source and binary forms, with or without modification, are permitted
6provided that the following conditions are met: 6provided that the following conditions are met:
7 7
8* Redistributions of source code must retain the above copyright notice, this list of conditions 8* Redistributions of source code must retain the above copyright notice, this list of conditions
9 and the following disclaimer. 9 and the following disclaimer.
10* Redistributions in binary form must reproduce the above copyright notice, this list of conditions 10* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
11 and the following disclaimer in the documentation and/or other materials provided with the 11 and the following disclaimer in the documentation and/or other materials provided with the
12 distribution. 12 distribution.
13* The name of the author may not be used to endorse or promote products derived from this software 13* The name of the author may not be used to endorse or promote products derived from this software
14 without specific prior written permission. 14 without specific prior written permission.
15 15
16THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, 16THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
17BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 18ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 19EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 20OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
@@ -34,560 +34,560 @@ using Prebuild.Core.Utilities;
34 34
35namespace Prebuild.Core.Targets 35namespace Prebuild.Core.Targets
36{ 36{
37 [Target("vs2003")] 37 [Target("vs2003")]
38 public class VS2003Target : ITarget 38 public class VS2003Target : ITarget
39 { 39 {
40 40
41 #region Fields 41 #region Fields
42 42
43 string solutionVersion = "8.00"; 43 string solutionVersion = "8.00";
44 string productVersion = "7.10.3077"; 44 string productVersion = "7.10.3077";
45 string schemaVersion = "2.0"; 45 string schemaVersion = "2.0";
46 string versionName = "2003"; 46 string versionName = "2003";
47 VSVersion version = VSVersion.VS71; 47 VSVersion version = VSVersion.VS71;
48 48
49 readonly Dictionary<string, ToolInfo> m_Tools = new Dictionary<string, ToolInfo>(); 49 readonly Dictionary<string, ToolInfo> m_Tools = new Dictionary<string, ToolInfo>();
50 Kernel m_Kernel; 50 Kernel m_Kernel;
51 51
52 /// <summary> 52 /// <summary>
53 /// Gets or sets the solution version. 53 /// Gets or sets the solution version.
54 /// </summary> 54 /// </summary>
55 /// <value>The solution version.</value> 55 /// <value>The solution version.</value>
56 protected string SolutionVersion 56 protected string SolutionVersion
57 { 57 {
58 get 58 get
59 { 59 {
60 return solutionVersion; 60 return solutionVersion;
61 } 61 }
62 set 62 set
63 { 63 {
64 solutionVersion = value; 64 solutionVersion = value;
65 } 65 }
66 } 66 }
67 /// <summary> 67 /// <summary>
68 /// Gets or sets the product version. 68 /// Gets or sets the product version.
69 /// </summary> 69 /// </summary>
70 /// <value>The product version.</value> 70 /// <value>The product version.</value>
71 protected string ProductVersion 71 protected string ProductVersion
72 { 72 {
73 get 73 get
74 { 74 {
75 return productVersion; 75 return productVersion;
76 } 76 }
77 set 77 set
78 { 78 {
79 productVersion = value; 79 productVersion = value;
80 } 80 }
81 } 81 }
82 /// <summary> 82 /// <summary>
83 /// Gets or sets the schema version. 83 /// Gets or sets the schema version.
84 /// </summary> 84 /// </summary>
85 /// <value>The schema version.</value> 85 /// <value>The schema version.</value>
86 protected string SchemaVersion 86 protected string SchemaVersion
87 { 87 {
88 get 88 get
89 { 89 {
90 return schemaVersion; 90 return schemaVersion;
91 } 91 }
92 set 92 set
93 { 93 {
94 schemaVersion = value; 94 schemaVersion = value;
95 } 95 }
96 } 96 }
97 /// <summary> 97 /// <summary>
98 /// Gets or sets the name of the version. 98 /// Gets or sets the name of the version.
99 /// </summary> 99 /// </summary>
100 /// <value>The name of the version.</value> 100 /// <value>The name of the version.</value>
101 protected string VersionName 101 protected string VersionName
102 { 102 {
103 get 103 get
104 { 104 {
105 return versionName; 105 return versionName;
106 } 106 }
107 set 107 set
108 { 108 {
109 versionName = value; 109 versionName = value;
110 } 110 }
111 } 111 }
112 /// <summary> 112 /// <summary>
113 /// Gets or sets the version. 113 /// Gets or sets the version.
114 /// </summary> 114 /// </summary>
115 /// <value>The version.</value> 115 /// <value>The version.</value>
116 protected VSVersion Version 116 protected VSVersion Version
117 { 117 {
118 get 118 get
119 { 119 {
120 return version; 120 return version;
121 } 121 }
122 set 122 set
123 { 123 {
124 version = value; 124 version = value;
125 } 125 }
126 } 126 }
127 127
128 #endregion 128 #endregion
129 129
130 #region Constructors 130 #region Constructors
131 131
132 /// <summary> 132 /// <summary>
133 /// Initializes a new instance of the <see cref="VS2003Target"/> class. 133 /// Initializes a new instance of the <see cref="VS2003Target"/> class.
134 /// </summary> 134 /// </summary>
135 public VS2003Target() 135 public VS2003Target()
136 { 136 {
137 m_Tools["C#"] = new ToolInfo("C#", "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}", "csproj", "CSHARP"); 137 m_Tools["C#"] = new ToolInfo("C#", "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}", "csproj", "CSHARP");
138 m_Tools["VB.NET"] = new ToolInfo("VB.NET", "{F184B08F-C81C-45F6-A57F-5ABD9991F28F}", "vbproj", "VisualBasic"); 138 m_Tools["VB.NET"] = new ToolInfo("VB.NET", "{F184B08F-C81C-45F6-A57F-5ABD9991F28F}", "vbproj", "VisualBasic");
139 } 139 }
140 140
141 #endregion 141 #endregion
142 142
143 #region Private Methods 143 #region Private Methods
144 144
145 private string MakeRefPath(ProjectNode project) 145 private string MakeRefPath(ProjectNode project)
146 { 146 {
147 string ret = ""; 147 string ret = "";
148 foreach(ReferencePathNode node in project.ReferencePaths) 148 foreach(ReferencePathNode node in project.ReferencePaths)
149 { 149 {
150 try 150 try
151 { 151 {
152 string fullPath = Helper.ResolvePath(node.Path); 152 string fullPath = Helper.ResolvePath(node.Path);
153 if(ret.Length < 1) 153 if(ret.Length < 1)
154 { 154 {
155 ret = fullPath; 155 ret = fullPath;
156 } 156 }
157 else 157 else
158 { 158 {
159 ret += ";" + fullPath; 159 ret += ";" + fullPath;
160 } 160 }
161 } 161 }
162 catch(ArgumentException) 162 catch(ArgumentException)
163 { 163 {
164 m_Kernel.Log.Write(LogType.Warning, "Could not resolve reference path: {0}", node.Path); 164 m_Kernel.Log.Write(LogType.Warning, "Could not resolve reference path: {0}", node.Path);
165 } 165 }
166 } 166 }
167 167
168 return ret; 168 return ret;
169 } 169 }
170 170
171 private void WriteProject(SolutionNode solution, ProjectNode project) 171 private void WriteProject(SolutionNode solution, ProjectNode project)
172 { 172 {
173 if(!m_Tools.ContainsKey(project.Language)) 173 if(!m_Tools.ContainsKey(project.Language))
174 { 174 {
175 throw new UnknownLanguageException("Unknown .NET language: " + project.Language); 175 throw new UnknownLanguageException("Unknown .NET language: " + project.Language);
176 } 176 }
177 177
178 ToolInfo toolInfo = m_Tools[project.Language]; 178 ToolInfo toolInfo = m_Tools[project.Language];
179 string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, toolInfo.FileExtension); 179 string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, toolInfo.FileExtension);
180 StreamWriter ps = new StreamWriter(projectFile); 180 StreamWriter ps = new StreamWriter(projectFile);
181 181
182 m_Kernel.CurrentWorkingDirectory.Push(); 182 m_Kernel.CurrentWorkingDirectory.Push();
183 Helper.SetCurrentDir(Path.GetDirectoryName(projectFile)); 183 Helper.SetCurrentDir(Path.GetDirectoryName(projectFile));
184 184
185 using(ps) 185 using(ps)
186 { 186 {
187 ps.WriteLine("<VisualStudioProject>"); 187 ps.WriteLine("<VisualStudioProject>");
188 ps.WriteLine(" <{0}", toolInfo.XmlTag); 188 ps.WriteLine(" <{0}", toolInfo.XmlTag);
189 ps.WriteLine("\t\t\t\tProjectType = \"Local\""); 189 ps.WriteLine("\t\t\t\tProjectType = \"Local\"");
190 ps.WriteLine("\t\t\t\tProductVersion = \"{0}\"", ProductVersion); 190 ps.WriteLine("\t\t\t\tProductVersion = \"{0}\"", ProductVersion);
191 ps.WriteLine("\t\t\t\tSchemaVersion = \"{0}\"", SchemaVersion); 191 ps.WriteLine("\t\t\t\tSchemaVersion = \"{0}\"", SchemaVersion);
192 ps.WriteLine("\t\t\t\tProjectGuid = \"{{{0}}}\"", project.Guid.ToString().ToUpper()); 192 ps.WriteLine("\t\t\t\tProjectGuid = \"{{{0}}}\"", project.Guid.ToString().ToUpper());
193 ps.WriteLine("\t\t>"); 193 ps.WriteLine("\t\t>");
194 194
195 ps.WriteLine("\t\t\t\t<Build>"); 195 ps.WriteLine("\t\t\t\t<Build>");
196 ps.WriteLine(" <Settings"); 196 ps.WriteLine(" <Settings");
197 ps.WriteLine("\t\t\t\t ApplicationIcon = \"{0}\"",project.AppIcon); 197 ps.WriteLine("\t\t\t\t ApplicationIcon = \"{0}\"",project.AppIcon);
198 ps.WriteLine("\t\t\t\t AssemblyKeyContainerName = \"\""); 198 ps.WriteLine("\t\t\t\t AssemblyKeyContainerName = \"\"");
199 ps.WriteLine("\t\t\t\t AssemblyName = \"{0}\"", project.AssemblyName); 199 ps.WriteLine("\t\t\t\t AssemblyName = \"{0}\"", project.AssemblyName);
200 ps.WriteLine("\t\t\t\t AssemblyOriginatorKeyFile = \"\""); 200 ps.WriteLine("\t\t\t\t AssemblyOriginatorKeyFile = \"\"");
201 ps.WriteLine("\t\t\t\t DefaultClientScript = \"JScript\""); 201 ps.WriteLine("\t\t\t\t DefaultClientScript = \"JScript\"");
202 ps.WriteLine("\t\t\t\t DefaultHTMLPageLayout = \"Grid\""); 202 ps.WriteLine("\t\t\t\t DefaultHTMLPageLayout = \"Grid\"");
203 ps.WriteLine("\t\t\t\t DefaultTargetSchema = \"IE50\""); 203 ps.WriteLine("\t\t\t\t DefaultTargetSchema = \"IE50\"");
204 ps.WriteLine("\t\t\t\t DelaySign = \"false\""); 204 ps.WriteLine("\t\t\t\t DelaySign = \"false\"");
205 205
206 if(Version == VSVersion.VS70) 206 if(Version == VSVersion.VS70)
207 { 207 {
208 ps.WriteLine("\t\t\t\t NoStandardLibraries = \"false\""); 208 ps.WriteLine("\t\t\t\t NoStandardLibraries = \"false\"");
209 } 209 }
210 210
211 ps.WriteLine("\t\t\t\t OutputType = \"{0}\"", project.Type); 211 ps.WriteLine("\t\t\t\t OutputType = \"{0}\"", project.Type);
212 212
213 foreach(ConfigurationNode conf in project.Configurations) 213 foreach(ConfigurationNode conf in project.Configurations)
214 { 214 {
215 if (conf.Options["PreBuildEvent"] != null && conf.Options["PreBuildEvent"].ToString().Length != 0) 215 if (conf.Options["PreBuildEvent"] != null && conf.Options["PreBuildEvent"].ToString().Length != 0)
216 { 216 {
217 ps.WriteLine("\t\t\t\t PreBuildEvent = \"{0}\"", Helper.NormalizePath(conf.Options["PreBuildEvent"].ToString())); 217 ps.WriteLine("\t\t\t\t PreBuildEvent = \"{0}\"", Helper.NormalizePath(conf.Options["PreBuildEvent"].ToString()));
218 } 218 }
219 else 219 else
220 { 220 {
221 ps.WriteLine("\t\t\t\t PreBuildEvent = \"{0}\"", conf.Options["PreBuildEvent"]); 221 ps.WriteLine("\t\t\t\t PreBuildEvent = \"{0}\"", conf.Options["PreBuildEvent"]);
222 } 222 }
223 if (conf.Options["PostBuildEvent"] != null && conf.Options["PostBuildEvent"].ToString().Length != 0) 223 if (conf.Options["PostBuildEvent"] != null && conf.Options["PostBuildEvent"].ToString().Length != 0)
224 { 224 {
225 ps.WriteLine("\t\t\t\t PostBuildEvent = \"{0}\"", Helper.NormalizePath(conf.Options["PostBuildEvent"].ToString())); 225 ps.WriteLine("\t\t\t\t PostBuildEvent = \"{0}\"", Helper.NormalizePath(conf.Options["PostBuildEvent"].ToString()));
226 } 226 }
227 else 227 else
228 { 228 {
229 ps.WriteLine("\t\t\t\t PostBuildEvent = \"{0}\"", conf.Options["PostBuildEvent"]); 229 ps.WriteLine("\t\t\t\t PostBuildEvent = \"{0}\"", conf.Options["PostBuildEvent"]);
230 } 230 }
231 if (conf.Options["RunPostBuildEvent"] == null) 231 if (conf.Options["RunPostBuildEvent"] == null)
232 { 232 {
233 ps.WriteLine("\t\t\t\t RunPostBuildEvent = \"{0}\"", "OnBuildSuccess"); 233 ps.WriteLine("\t\t\t\t RunPostBuildEvent = \"{0}\"", "OnBuildSuccess");
234 } 234 }
235 else 235 else
236 { 236 {
237 ps.WriteLine("\t\t\t\t RunPostBuildEvent = \"{0}\"", conf.Options["RunPostBuildEvent"]); 237 ps.WriteLine("\t\t\t\t RunPostBuildEvent = \"{0}\"", conf.Options["RunPostBuildEvent"]);
238 } 238 }
239 break; 239 break;
240 } 240 }
241 241
242 ps.WriteLine("\t\t\t\t RootNamespace = \"{0}\"", project.RootNamespace); 242 ps.WriteLine("\t\t\t\t RootNamespace = \"{0}\"", project.RootNamespace);
243 ps.WriteLine("\t\t\t\t StartupObject = \"{0}\"", project.StartupObject); 243 ps.WriteLine("\t\t\t\t StartupObject = \"{0}\"", project.StartupObject);
244 ps.WriteLine("\t\t >"); 244 ps.WriteLine("\t\t >");
245 245
246 foreach(ConfigurationNode conf in project.Configurations) 246 foreach(ConfigurationNode conf in project.Configurations)
247 { 247 {
248 ps.WriteLine("\t\t\t\t <Config"); 248 ps.WriteLine("\t\t\t\t <Config");
249 ps.WriteLine("\t\t\t\t Name = \"{0}\"", conf.Name); 249 ps.WriteLine("\t\t\t\t Name = \"{0}\"", conf.Name);
250 ps.WriteLine("\t\t\t\t AllowUnsafeBlocks = \"{0}\"", conf.Options["AllowUnsafe"].ToString().ToLower()); 250 ps.WriteLine("\t\t\t\t AllowUnsafeBlocks = \"{0}\"", conf.Options["AllowUnsafe"].ToString().ToLower());
251 ps.WriteLine("\t\t\t\t BaseAddress = \"{0}\"", conf.Options["BaseAddress"]); 251 ps.WriteLine("\t\t\t\t BaseAddress = \"{0}\"", conf.Options["BaseAddress"]);
252 ps.WriteLine("\t\t\t\t CheckForOverflowUnderflow = \"{0}\"", conf.Options["CheckUnderflowOverflow"].ToString().ToLower()); 252 ps.WriteLine("\t\t\t\t CheckForOverflowUnderflow = \"{0}\"", conf.Options["CheckUnderflowOverflow"].ToString().ToLower());
253 ps.WriteLine("\t\t\t\t ConfigurationOverrideFile = \"\""); 253 ps.WriteLine("\t\t\t\t ConfigurationOverrideFile = \"\"");
254 ps.WriteLine("\t\t\t\t DefineConstants = \"{0}\"", conf.Options["CompilerDefines"]); 254 ps.WriteLine("\t\t\t\t DefineConstants = \"{0}\"", conf.Options["CompilerDefines"]);
255 ps.WriteLine("\t\t\t\t DocumentationFile = \"{0}\"", GetXmlDocFile(project, conf));//default to the assembly name 255 ps.WriteLine("\t\t\t\t DocumentationFile = \"{0}\"", GetXmlDocFile(project, conf));//default to the assembly name
256 ps.WriteLine("\t\t\t\t DebugSymbols = \"{0}\"", conf.Options["DebugInformation"].ToString().ToLower()); 256 ps.WriteLine("\t\t\t\t DebugSymbols = \"{0}\"", conf.Options["DebugInformation"].ToString().ToLower());
257 ps.WriteLine("\t\t\t\t FileAlignment = \"{0}\"", conf.Options["FileAlignment"]); 257 ps.WriteLine("\t\t\t\t FileAlignment = \"{0}\"", conf.Options["FileAlignment"]);
258 ps.WriteLine("\t\t\t\t IncrementalBuild = \"{0}\"", conf.Options["IncrementalBuild"].ToString().ToLower()); 258 ps.WriteLine("\t\t\t\t IncrementalBuild = \"{0}\"", conf.Options["IncrementalBuild"].ToString().ToLower());
259 259
260 if(Version == VSVersion.VS71) 260 if(Version == VSVersion.VS71)
261 { 261 {
262 ps.WriteLine("\t\t\t\t NoStdLib = \"{0}\"", conf.Options["NoStdLib"].ToString().ToLower()); 262 ps.WriteLine("\t\t\t\t NoStdLib = \"{0}\"", conf.Options["NoStdLib"].ToString().ToLower());
263 ps.WriteLine("\t\t\t\t NoWarn = \"{0}\"", conf.Options["SuppressWarnings"].ToString().ToLower()); 263 ps.WriteLine("\t\t\t\t NoWarn = \"{0}\"", conf.Options["SuppressWarnings"].ToString().ToLower());
264 } 264 }
265 265
266 ps.WriteLine("\t\t\t\t Optimize = \"{0}\"", conf.Options["OptimizeCode"].ToString().ToLower()); 266 ps.WriteLine("\t\t\t\t Optimize = \"{0}\"", conf.Options["OptimizeCode"].ToString().ToLower());
267 ps.WriteLine(" OutputPath = \"{0}\"", 267 ps.WriteLine(" OutputPath = \"{0}\"",
268 Helper.EndPath(Helper.NormalizePath(conf.Options["OutputPath"].ToString()))); 268 Helper.EndPath(Helper.NormalizePath(conf.Options["OutputPath"].ToString())));
269 ps.WriteLine(" RegisterForComInterop = \"{0}\"", conf.Options["RegisterComInterop"].ToString().ToLower()); 269 ps.WriteLine(" RegisterForComInterop = \"{0}\"", conf.Options["RegisterComInterop"].ToString().ToLower());
270 ps.WriteLine(" RemoveIntegerChecks = \"{0}\"", conf.Options["RemoveIntegerChecks"].ToString().ToLower()); 270 ps.WriteLine(" RemoveIntegerChecks = \"{0}\"", conf.Options["RemoveIntegerChecks"].ToString().ToLower());
271 ps.WriteLine(" TreatWarningsAsErrors = \"{0}\"", conf.Options["WarningsAsErrors"].ToString().ToLower()); 271 ps.WriteLine(" TreatWarningsAsErrors = \"{0}\"", conf.Options["WarningsAsErrors"].ToString().ToLower());
272 ps.WriteLine(" WarningLevel = \"{0}\"", conf.Options["WarningLevel"]); 272 ps.WriteLine(" WarningLevel = \"{0}\"", conf.Options["WarningLevel"]);
273 ps.WriteLine(" />"); 273 ps.WriteLine(" />");
274 } 274 }
275 275
276 ps.WriteLine(" </Settings>"); 276 ps.WriteLine(" </Settings>");
277 277
278 ps.WriteLine(" <References>"); 278 ps.WriteLine(" <References>");
279 foreach(ReferenceNode refr in project.References) 279 foreach(ReferenceNode refr in project.References)
280 { 280 {
281 ps.WriteLine(" <Reference"); 281 ps.WriteLine(" <Reference");
282 ps.WriteLine(" Name = \"{0}\"", refr.Name); 282 ps.WriteLine(" Name = \"{0}\"", refr.Name);
283 ps.WriteLine(" AssemblyName = \"{0}\"", refr.Name); 283 ps.WriteLine(" AssemblyName = \"{0}\"", refr.Name);
284 284
285 if(solution.ProjectsTable.ContainsKey(refr.Name)) 285 if(solution.ProjectsTable.ContainsKey(refr.Name))
286 { 286 {
287 ProjectNode refProject = solution.ProjectsTable[refr.Name]; 287 ProjectNode refProject = solution.ProjectsTable[refr.Name];
288 ps.WriteLine(" Project = \"{{{0}}}\"", refProject.Guid.ToString().ToUpper()); 288 ps.WriteLine(" Project = \"{{{0}}}\"", refProject.Guid.ToString().ToUpper());
289 ps.WriteLine(" Package = \"{0}\"", toolInfo.Guid.ToUpper()); 289 ps.WriteLine(" Package = \"{0}\"", toolInfo.Guid.ToUpper());
290 } 290 }
291 else 291 else
292 { 292 {
293 if(refr.Path != null) 293 if(refr.Path != null)
294 { 294 {
295 ps.WriteLine(" HintPath = \"{0}\"", Helper.MakeFilePath(refr.Path, refr.Name, "dll")); 295 ps.WriteLine(" HintPath = \"{0}\"", Helper.MakeFilePath(refr.Path, refr.Name, "dll"));
296 } 296 }
297 297
298 } 298 }
299 299
300 if(refr.LocalCopySpecified) 300 if(refr.LocalCopySpecified)
301 { 301 {
302 ps.WriteLine(" Private = \"{0}\"",refr.LocalCopy); 302 ps.WriteLine(" Private = \"{0}\"",refr.LocalCopy);
303 } 303 }
304 304
305 ps.WriteLine(" />"); 305 ps.WriteLine(" />");
306 } 306 }
307 ps.WriteLine(" </References>"); 307 ps.WriteLine(" </References>");
308 308
309 ps.WriteLine(" </Build>"); 309 ps.WriteLine(" </Build>");
310 ps.WriteLine(" <Files>"); 310 ps.WriteLine(" <Files>");
311 311
312 ps.WriteLine(" <Include>"); 312 ps.WriteLine(" <Include>");
313 313
314 foreach(string file in project.Files) 314 foreach(string file in project.Files)
315 { 315 {
316 string fileName = file.Replace(".\\", ""); 316 string fileName = file.Replace(".\\", "");
317 ps.WriteLine(" <File"); 317 ps.WriteLine(" <File");
318 ps.WriteLine(" RelPath = \"{0}\"", fileName); 318 ps.WriteLine(" RelPath = \"{0}\"", fileName);
319 ps.WriteLine(" SubType = \"{0}\"", project.Files.GetSubType(file)); 319 ps.WriteLine(" SubType = \"{0}\"", project.Files.GetSubType(file));
320 ps.WriteLine(" BuildAction = \"{0}\"", project.Files.GetBuildAction(file)); 320 ps.WriteLine(" BuildAction = \"{0}\"", project.Files.GetBuildAction(file));
321 ps.WriteLine(" />"); 321 ps.WriteLine(" />");
322 322
323 if (project.Files.GetSubType(file) != SubType.Code && project.Files.GetSubType(file) != SubType.Settings) 323 if (project.Files.GetSubType(file) != SubType.Code && project.Files.GetSubType(file) != SubType.Settings)
324 { 324 {
325 ps.WriteLine(" <File"); 325 ps.WriteLine(" <File");
326 ps.WriteLine(" RelPath = \"{0}\"", fileName.Substring(0, fileName.LastIndexOf('.')) + ".resx"); 326 ps.WriteLine(" RelPath = \"{0}\"", fileName.Substring(0, fileName.LastIndexOf('.')) + ".resx");
327 int slash = fileName.LastIndexOf('\\'); 327 int slash = fileName.LastIndexOf('\\');
328 if (slash == -1) 328 if (slash == -1)
329 { 329 {
330 ps.WriteLine(" DependentUpon = \"{0}\"", fileName); 330 ps.WriteLine(" DependentUpon = \"{0}\"", fileName);
331 } 331 }
332 else 332 else
333 { 333 {
334 ps.WriteLine(" DependentUpon = \"{0}\"", fileName.Substring(slash + 1, fileName.Length - slash - 1)); 334 ps.WriteLine(" DependentUpon = \"{0}\"", fileName.Substring(slash + 1, fileName.Length - slash - 1));
335 } 335 }
336 ps.WriteLine(" BuildAction = \"{0}\"", "EmbeddedResource"); 336 ps.WriteLine(" BuildAction = \"{0}\"", "EmbeddedResource");
337 ps.WriteLine(" />"); 337 ps.WriteLine(" />");
338 338
339 } 339 }
340 } 340 }
341 ps.WriteLine(" </Include>"); 341 ps.WriteLine(" </Include>");
342 342
343 ps.WriteLine(" </Files>"); 343 ps.WriteLine(" </Files>");
344 ps.WriteLine(" </{0}>", toolInfo.XmlTag); 344 ps.WriteLine(" </{0}>", toolInfo.XmlTag);
345 ps.WriteLine("</VisualStudioProject>"); 345 ps.WriteLine("</VisualStudioProject>");
346 } 346 }
347 347
348 ps = new StreamWriter(projectFile + ".user"); 348 ps = new StreamWriter(projectFile + ".user");
349 using(ps) 349 using(ps)
350 { 350 {
351 ps.WriteLine("<VisualStudioProject>"); 351 ps.WriteLine("<VisualStudioProject>");
352 ps.WriteLine(" <{0}>", toolInfo.XmlTag); 352 ps.WriteLine(" <{0}>", toolInfo.XmlTag);
353 ps.WriteLine(" <Build>"); 353 ps.WriteLine(" <Build>");
354 354
355 ps.WriteLine(" <Settings ReferencePath=\"{0}\">", MakeRefPath(project)); 355 ps.WriteLine(" <Settings ReferencePath=\"{0}\">", MakeRefPath(project));
356 foreach(ConfigurationNode conf in project.Configurations) 356 foreach(ConfigurationNode conf in project.Configurations)
357 { 357 {
358 ps.WriteLine(" <Config"); 358 ps.WriteLine(" <Config");
359 ps.WriteLine(" Name = \"{0}\"", conf.Name); 359 ps.WriteLine(" Name = \"{0}\"", conf.Name);
360 ps.WriteLine(" />"); 360 ps.WriteLine(" />");
361 } 361 }
362 ps.WriteLine(" </Settings>"); 362 ps.WriteLine(" </Settings>");
363 363
364 ps.WriteLine(" </Build>"); 364 ps.WriteLine(" </Build>");
365 ps.WriteLine(" </{0}>", toolInfo.XmlTag); 365 ps.WriteLine(" </{0}>", toolInfo.XmlTag);
366 ps.WriteLine("</VisualStudioProject>"); 366 ps.WriteLine("</VisualStudioProject>");
367 } 367 }
368 368
369 m_Kernel.CurrentWorkingDirectory.Pop(); 369 m_Kernel.CurrentWorkingDirectory.Pop();
370 } 370 }
371 371
372 /// <summary> 372 /// <summary>
373 /// Gets the XML doc file. 373 /// Gets the XML doc file.
374 /// </summary> 374 /// </summary>
375 /// <param name="project">The project.</param> 375 /// <param name="project">The project.</param>
376 /// <param name="conf">The conf.</param> 376 /// <param name="conf">The conf.</param>
377 /// <returns></returns> 377 /// <returns></returns>
378 public static string GetXmlDocFile(ProjectNode project, ConfigurationNode conf) 378 public static string GetXmlDocFile(ProjectNode project, ConfigurationNode conf)
379 { 379 {
380 if( conf == null ) 380 if( conf == null )
381 { 381 {
382 throw new ArgumentNullException("conf"); 382 throw new ArgumentNullException("conf");
383 } 383 }
384 if( project == null ) 384 if( project == null )
385 { 385 {
386 throw new ArgumentNullException("project"); 386 throw new ArgumentNullException("project");
387 } 387 }
388 // if(!(bool)conf.Options["GenerateXmlDocFile"]) //default to none, if the generate option is false 388 // if(!(bool)conf.Options["GenerateXmlDocFile"]) //default to none, if the generate option is false
389 // { 389 // {
390 // return string.Empty; 390 // return string.Empty;
391 // } 391 // }
392 392
393 //default to "AssemblyName.xml" 393 //default to "AssemblyName.xml"
394 //string defaultValue = Path.GetFileNameWithoutExtension(project.AssemblyName) + ".xml"; 394 //string defaultValue = Path.GetFileNameWithoutExtension(project.AssemblyName) + ".xml";
395 //return (string)conf.Options["XmlDocFile", defaultValue]; 395 //return (string)conf.Options["XmlDocFile", defaultValue];
396 396
397 //default to no XmlDocFile file 397 //default to no XmlDocFile file
398 return (string)conf.Options["XmlDocFile", ""]; 398 return (string)conf.Options["XmlDocFile", ""];
399 } 399 }
400 400
401 private void WriteSolution(SolutionNode solution) 401 private void WriteSolution(SolutionNode solution)
402 { 402 {
403 m_Kernel.Log.Write("Creating Visual Studio {0} solution and project files", VersionName); 403 m_Kernel.Log.Write("Creating Visual Studio {0} solution and project files", VersionName);
404 404
405 foreach(ProjectNode project in solution.Projects) 405 foreach(ProjectNode project in solution.Projects)
406 { 406 {
407 if(m_Kernel.AllowProject(project.FilterGroups)) 407 if(m_Kernel.AllowProject(project.FilterGroups))
408 { 408 {
409 m_Kernel.Log.Write("...Creating project: {0}", project.Name); 409 m_Kernel.Log.Write("...Creating project: {0}", project.Name);
410 WriteProject(solution, project); 410 WriteProject(solution, project);
411 } 411 }
412 } 412 }
413 413
414 m_Kernel.Log.Write(""); 414 m_Kernel.Log.Write("");
415 string solutionFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "sln"); 415 string solutionFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "sln");
416 StreamWriter ss = new StreamWriter(solutionFile); 416 StreamWriter ss = new StreamWriter(solutionFile);
417 417
418 m_Kernel.CurrentWorkingDirectory.Push(); 418 m_Kernel.CurrentWorkingDirectory.Push();
419 Helper.SetCurrentDir(Path.GetDirectoryName(solutionFile)); 419 Helper.SetCurrentDir(Path.GetDirectoryName(solutionFile));
420 420
421 using(ss) 421 using(ss)
422 { 422 {
423 ss.WriteLine("Microsoft Visual Studio Solution File, Format Version {0}", SolutionVersion); 423 ss.WriteLine("Microsoft Visual Studio Solution File, Format Version {0}", SolutionVersion);
424 foreach(ProjectNode project in solution.Projects) 424 foreach(ProjectNode project in solution.Projects)
425 { 425 {
426 if(!m_Tools.ContainsKey(project.Language)) 426 if(!m_Tools.ContainsKey(project.Language))
427 { 427 {
428 throw new UnknownLanguageException("Unknown .NET language: " + project.Language); 428 throw new UnknownLanguageException("Unknown .NET language: " + project.Language);
429 } 429 }
430 430
431 ToolInfo toolInfo = m_Tools[project.Language]; 431 ToolInfo toolInfo = m_Tools[project.Language];
432 432
433 string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); 433 string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath);
434 ss.WriteLine("Project(\"{0}\") = \"{1}\", \"{2}\", \"{{{3}}}\"", 434 ss.WriteLine("Project(\"{0}\") = \"{1}\", \"{2}\", \"{{{3}}}\"",
435 toolInfo.Guid, project.Name, Helper.MakeFilePath(path, project.Name, 435 toolInfo.Guid, project.Name, Helper.MakeFilePath(path, project.Name,
436 toolInfo.FileExtension), project.Guid.ToString().ToUpper()); 436 toolInfo.FileExtension), project.Guid.ToString().ToUpper());
437 437
438 ss.WriteLine("\tProjectSection(ProjectDependencies) = postProject"); 438 ss.WriteLine("\tProjectSection(ProjectDependencies) = postProject");
439 ss.WriteLine("\tEndProjectSection"); 439 ss.WriteLine("\tEndProjectSection");
440 440
441 ss.WriteLine("EndProject"); 441 ss.WriteLine("EndProject");
442 } 442 }
443 443
444 ss.WriteLine("Global"); 444 ss.WriteLine("Global");
445 445
446 ss.WriteLine("\tGlobalSection(SolutionConfiguration) = preSolution"); 446 ss.WriteLine("\tGlobalSection(SolutionConfiguration) = preSolution");
447 foreach(ConfigurationNode conf in solution.Configurations) 447 foreach(ConfigurationNode conf in solution.Configurations)
448 { 448 {
449 ss.WriteLine("\t\t{0} = {0}", conf.Name); 449 ss.WriteLine("\t\t{0} = {0}", conf.Name);
450 } 450 }
451 ss.WriteLine("\tEndGlobalSection"); 451 ss.WriteLine("\tEndGlobalSection");
452 452
453 ss.WriteLine("\tGlobalSection(ProjectDependencies) = postSolution"); 453 ss.WriteLine("\tGlobalSection(ProjectDependencies) = postSolution");
454 foreach(ProjectNode project in solution.Projects) 454 foreach(ProjectNode project in solution.Projects)
455 { 455 {
456 for(int i = 0; i < project.References.Count; i++) 456 for(int i = 0; i < project.References.Count; i++)
457 { 457 {
458 ReferenceNode refr = project.References[i]; 458 ReferenceNode refr = project.References[i];
459 if(solution.ProjectsTable.ContainsKey(refr.Name)) 459 if(solution.ProjectsTable.ContainsKey(refr.Name))
460 { 460 {
461 ProjectNode refProject = solution.ProjectsTable[refr.Name]; 461 ProjectNode refProject = solution.ProjectsTable[refr.Name];
462 ss.WriteLine("\t\t({{{0}}}).{1} = ({{{2}}})", 462 ss.WriteLine("\t\t({{{0}}}).{1} = ({{{2}}})",
463 project.Guid.ToString().ToUpper() 463 project.Guid.ToString().ToUpper()
464 , i, 464 , i,
465 refProject.Guid.ToString().ToUpper() 465 refProject.Guid.ToString().ToUpper()
466 ); 466 );
467 } 467 }
468 } 468 }
469 } 469 }
470 ss.WriteLine("\tEndGlobalSection"); 470 ss.WriteLine("\tEndGlobalSection");
471 471
472 ss.WriteLine("\tGlobalSection(ProjectConfiguration) = postSolution"); 472 ss.WriteLine("\tGlobalSection(ProjectConfiguration) = postSolution");
473 foreach(ProjectNode project in solution.Projects) 473 foreach(ProjectNode project in solution.Projects)
474 { 474 {
475 foreach(ConfigurationNode conf in solution.Configurations) 475 foreach(ConfigurationNode conf in solution.Configurations)
476 { 476 {
477 ss.WriteLine("\t\t{{{0}}}.{1}.ActiveCfg = {1}|.NET", 477 ss.WriteLine("\t\t{{{0}}}.{1}.ActiveCfg = {1}|.NET",
478 project.Guid.ToString().ToUpper(), 478 project.Guid.ToString().ToUpper(),
479 conf.Name); 479 conf.Name);
480 480
481 ss.WriteLine("\t\t{{{0}}}.{1}.Build.0 = {1}|.NET", 481 ss.WriteLine("\t\t{{{0}}}.{1}.Build.0 = {1}|.NET",
482 project.Guid.ToString().ToUpper(), 482 project.Guid.ToString().ToUpper(),
483 conf.Name); 483 conf.Name);
484 } 484 }
485 } 485 }
486 ss.WriteLine("\tEndGlobalSection"); 486 ss.WriteLine("\tEndGlobalSection");
487 487
488 if(solution.Files != null) 488 if(solution.Files != null)
489 { 489 {
490 ss.WriteLine("\tGlobalSection(SolutionItems) = postSolution"); 490 ss.WriteLine("\tGlobalSection(SolutionItems) = postSolution");
491 foreach(string file in solution.Files) 491 foreach(string file in solution.Files)
492 { 492 {
493 ss.WriteLine("\t\t{0} = {0}", file); 493 ss.WriteLine("\t\t{0} = {0}", file);
494 } 494 }
495 ss.WriteLine("\tEndGlobalSection"); 495 ss.WriteLine("\tEndGlobalSection");
496 } 496 }
497 497
498 ss.WriteLine("\tGlobalSection(ExtensibilityGlobals) = postSolution"); 498 ss.WriteLine("\tGlobalSection(ExtensibilityGlobals) = postSolution");
499 ss.WriteLine("\tEndGlobalSection"); 499 ss.WriteLine("\tEndGlobalSection");
500 ss.WriteLine("\tGlobalSection(ExtensibilityAddIns) = postSolution"); 500 ss.WriteLine("\tGlobalSection(ExtensibilityAddIns) = postSolution");
501 ss.WriteLine("\tEndGlobalSection"); 501 ss.WriteLine("\tEndGlobalSection");
502 502
503 ss.WriteLine("EndGlobal"); 503 ss.WriteLine("EndGlobal");
504 } 504 }
505 505
506 m_Kernel.CurrentWorkingDirectory.Pop(); 506 m_Kernel.CurrentWorkingDirectory.Pop();
507 } 507 }
508 508
509 private void CleanProject(ProjectNode project) 509 private void CleanProject(ProjectNode project)
510 { 510 {
511 m_Kernel.Log.Write("...Cleaning project: {0}", project.Name); 511 m_Kernel.Log.Write("...Cleaning project: {0}", project.Name);
512 512
513 ToolInfo toolInfo = m_Tools[project.Language]; 513 ToolInfo toolInfo = m_Tools[project.Language];
514 string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, toolInfo.FileExtension); 514 string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, toolInfo.FileExtension);
515 string userFile = projectFile + ".user"; 515 string userFile = projectFile + ".user";
516 516
517 Helper.DeleteIfExists(projectFile); 517 Helper.DeleteIfExists(projectFile);
518 Helper.DeleteIfExists(userFile); 518 Helper.DeleteIfExists(userFile);
519 } 519 }
520 520
521 private void CleanSolution(SolutionNode solution) 521 private void CleanSolution(SolutionNode solution)
522 { 522 {
523 m_Kernel.Log.Write("Cleaning Visual Studio {0} solution and project files", VersionName, solution.Name); 523 m_Kernel.Log.Write("Cleaning Visual Studio {0} solution and project files", VersionName, solution.Name);
524 524
525 string slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "sln"); 525 string slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "sln");
526 string suoFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "suo"); 526 string suoFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "suo");
527 527
528 Helper.DeleteIfExists(slnFile); 528 Helper.DeleteIfExists(slnFile);
529 Helper.DeleteIfExists(suoFile); 529 Helper.DeleteIfExists(suoFile);
530 530
531 foreach(ProjectNode project in solution.Projects) 531 foreach(ProjectNode project in solution.Projects)
532 { 532 {
533 CleanProject(project); 533 CleanProject(project);
534 } 534 }
535 535
536 m_Kernel.Log.Write(""); 536 m_Kernel.Log.Write("");
537 } 537 }
538 538
539 #endregion 539 #endregion
540 540
541 #region ITarget Members 541 #region ITarget Members
542 542
543 /// <summary> 543 /// <summary>
544 /// Writes the specified kern. 544 /// Writes the specified kern.
545 /// </summary> 545 /// </summary>
546 /// <param name="kern">The kern.</param> 546 /// <param name="kern">The kern.</param>
547 public virtual void Write(Kernel kern) 547 public virtual void Write(Kernel kern)
548 { 548 {
549 if( kern == null ) 549 if( kern == null )
550 { 550 {
551 throw new ArgumentNullException("kern"); 551 throw new ArgumentNullException("kern");
552 } 552 }
553 m_Kernel = kern; 553 m_Kernel = kern;
554 foreach(SolutionNode sol in m_Kernel.Solutions) 554 foreach(SolutionNode sol in m_Kernel.Solutions)
555 { 555 {
556 WriteSolution(sol); 556 WriteSolution(sol);
557 } 557 }
558 m_Kernel = null; 558 m_Kernel = null;
559 } 559 }
560 560
561 /// <summary> 561 /// <summary>
562 /// Cleans the specified kern. 562 /// Cleans the specified kern.
563 /// </summary> 563 /// </summary>
564 /// <param name="kern">The kern.</param> 564 /// <param name="kern">The kern.</param>
565 public virtual void Clean(Kernel kern) 565 public virtual void Clean(Kernel kern)
566 { 566 {
567 if( kern == null ) 567 if( kern == null )
568 { 568 {
569 throw new ArgumentNullException("kern"); 569 throw new ArgumentNullException("kern");
570 } 570 }
571 m_Kernel = kern; 571 m_Kernel = kern;
572 foreach(SolutionNode sol in m_Kernel.Solutions) 572 foreach(SolutionNode sol in m_Kernel.Solutions)
573 { 573 {
574 CleanSolution(sol); 574 CleanSolution(sol);
575 } 575 }
576 m_Kernel = null; 576 m_Kernel = null;
577 } 577 }
578 578
579 /// <summary> 579 /// <summary>
580 /// Gets the name. 580 /// Gets the name.
581 /// </summary> 581 /// </summary>
582 /// <value>The name.</value> 582 /// <value>The name.</value>
583 public virtual string Name 583 public virtual string Name
584 { 584 {
585 get 585 get
586 { 586 {
587 return "vs2003"; 587 return "vs2003";
588 } 588 }
589 } 589 }
590 590
591 #endregion 591 #endregion
592 } 592 }
593} 593}
diff --git a/Prebuild/src/Core/Targets/VS2005Target.cs b/Prebuild/src/Core/Targets/VS2005Target.cs
index e5a0939..9c70e26 100644
--- a/Prebuild/src/Core/Targets/VS2005Target.cs
+++ b/Prebuild/src/Core/Targets/VS2005Target.cs
@@ -5,16 +5,16 @@ Copyright (c) 2004 Matthew Holmes (matthew@wildfiregames.com)
5Redistribution and use in source and binary forms, with or without modification, are permitted 5Redistribution and use in source and binary forms, with or without modification, are permitted
6provided that the following conditions are met: 6provided that the following conditions are met:
7 7
8* Redistributions of source code must retain the above copyright notice, this list of conditions 8* Redistributions of source code must retain the above copyright notice, this list of conditions
9 and the following disclaimer. 9 and the following disclaimer.
10* Redistributions in binary form must reproduce the above copyright notice, this list of conditions 10* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
11 and the following disclaimer in the documentation and/or other materials provided with the 11 and the following disclaimer in the documentation and/or other materials provided with the
12 distribution. 12 distribution.
13* The name of the author may not be used to endorse or promote products derived from this software 13* The name of the author may not be used to endorse or promote products derived from this software
14 without specific prior written permission. 14 without specific prior written permission.
15 15
16THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, 16THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
17BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 18ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 19EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 20OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
@@ -35,7 +35,7 @@ using Prebuild.Core.Utilities;
35namespace Prebuild.Core.Targets 35namespace Prebuild.Core.Targets
36{ 36{
37 /// <summary> 37 /// <summary>
38 /// 38 ///
39 /// </summary> 39 /// </summary>
40 [Target("vs2005")] 40 [Target("vs2005")]
41 public class VS2005Target : VSGenericTarget 41 public class VS2005Target : VSGenericTarget
@@ -137,9 +137,9 @@ namespace Prebuild.Core.Targets
137 /// <summary> 137 /// <summary>
138 /// Initializes a new instance of the <see cref="VS2005Target"/> class. 138 /// Initializes a new instance of the <see cref="VS2005Target"/> class.
139 /// </summary> 139 /// </summary>
140 public VS2005Target() 140 public VS2005Target()
141 : base() 141 : base()
142 { 142 {
143 } 143 }
144 144
145 #endregion 145 #endregion
diff --git a/Prebuild/src/Core/Targets/VS2008Target.cs b/Prebuild/src/Core/Targets/VS2008Target.cs
index a3f3aca..fee4f7f 100644
--- a/Prebuild/src/Core/Targets/VS2008Target.cs
+++ b/Prebuild/src/Core/Targets/VS2008Target.cs
@@ -11,86 +11,86 @@ using System.CodeDom.Compiler;
11namespace Prebuild.Core.Targets 11namespace Prebuild.Core.Targets
12{ 12{
13 13
14 /// <summary> 14 /// <summary>
15 /// 15 ///
16 /// </summary> 16 /// </summary>
17 [Target("vs2008")] 17 [Target("vs2008")]
18 public class VS2008Target : VSGenericTarget 18 public class VS2008Target : VSGenericTarget
19 { 19 {
20 #region Fields 20 #region Fields
21 string solutionVersion = "10.00"; 21 string solutionVersion = "10.00";
22 string productVersion = "9.0.21022"; 22 string productVersion = "9.0.21022";
23 string schemaVersion = "2.0"; 23 string schemaVersion = "2.0";
24 string versionName = "Visual Studio 2008"; 24 string versionName = "Visual Studio 2008";
25 string name = "vs2008"; 25 string name = "vs2008";
26 VSVersion version = VSVersion.VS90; 26 VSVersion version = VSVersion.VS90;
27 27
28 /// <summary> 28 /// <summary>
29 /// Gets or sets the solution version. 29 /// Gets or sets the solution version.
30 /// </summary> 30 /// </summary>
31 /// <value>The solution version.</value> 31 /// <value>The solution version.</value>
32 public override string SolutionVersion 32 public override string SolutionVersion
33 { 33 {
34 get 34 get
35 { 35 {
36 return solutionVersion; 36 return solutionVersion;
37 } 37 }
38 } 38 }
39 /// <summary> 39 /// <summary>
40 /// Gets or sets the product version. 40 /// Gets or sets the product version.
41 /// </summary> 41 /// </summary>
42 /// <value>The product version.</value> 42 /// <value>The product version.</value>
43 public override string ProductVersion 43 public override string ProductVersion
44 { 44 {
45 get 45 get
46 { 46 {
47 return productVersion; 47 return productVersion;
48 } 48 }
49 } 49 }
50 /// <summary> 50 /// <summary>
51 /// Gets or sets the schema version. 51 /// Gets or sets the schema version.
52 /// </summary> 52 /// </summary>
53 /// <value>The schema version.</value> 53 /// <value>The schema version.</value>
54 public override string SchemaVersion 54 public override string SchemaVersion
55 { 55 {
56 get 56 get
57 { 57 {
58 return schemaVersion; 58 return schemaVersion;
59 } 59 }
60 } 60 }
61 /// <summary> 61 /// <summary>
62 /// Gets or sets the name of the version. 62 /// Gets or sets the name of the version.
63 /// </summary> 63 /// </summary>
64 /// <value>The name of the version.</value> 64 /// <value>The name of the version.</value>
65 public override string VersionName 65 public override string VersionName
66 { 66 {
67 get 67 get
68 { 68 {
69 return versionName; 69 return versionName;
70 } 70 }
71 } 71 }
72 /// <summary> 72 /// <summary>
73 /// Gets or sets the version. 73 /// Gets or sets the version.
74 /// </summary> 74 /// </summary>
75 /// <value>The version.</value> 75 /// <value>The version.</value>
76 public override VSVersion Version 76 public override VSVersion Version
77 { 77 {
78 get 78 get
79 { 79 {
80 return version; 80 return version;
81 } 81 }
82 } 82 }
83 /// <summary> 83 /// <summary>
84 /// Gets the name. 84 /// Gets the name.
85 /// </summary> 85 /// </summary>
86 /// <value>The name.</value> 86 /// <value>The name.</value>
87 public override string Name 87 public override string Name
88 { 88 {
89 get 89 get
90 { 90 {
91 return name; 91 return name;
92 } 92 }
93 } 93 }
94 94
95 protected override string GetToolsVersionXml(FrameworkVersion frameworkVersion) 95 protected override string GetToolsVersionXml(FrameworkVersion frameworkVersion)
96 { 96 {
@@ -110,18 +110,18 @@ namespace Prebuild.Core.Targets
110 get { return "# Visual Studio 2008"; } 110 get { return "# Visual Studio 2008"; }
111 } 111 }
112 112
113 #endregion 113 #endregion
114 114
115 #region Constructors 115 #region Constructors
116 116
117 /// <summary> 117 /// <summary>
118 /// Initializes a new instance of the <see cref="VS2005Target"/> class. 118 /// Initializes a new instance of the <see cref="VS2005Target"/> class.
119 /// </summary> 119 /// </summary>
120 public VS2008Target() 120 public VS2008Target()
121 : base() 121 : base()
122 { 122 {
123 } 123 }
124 124
125 #endregion 125 #endregion
126 } 126 }
127} 127}
diff --git a/Prebuild/src/Core/Targets/VS2010Target.cs b/Prebuild/src/Core/Targets/VS2010Target.cs
index b4c79dc..e8aeab5 100644
--- a/Prebuild/src/Core/Targets/VS2010Target.cs
+++ b/Prebuild/src/Core/Targets/VS2010Target.cs
@@ -11,96 +11,96 @@ using System.CodeDom.Compiler;
11namespace Prebuild.Core.Targets 11namespace Prebuild.Core.Targets
12{ 12{
13 13
14 /// <summary> 14 /// <summary>
15 /// 15 ///
16 /// </summary> 16 /// </summary>
17 [Target("vs2010")] 17 [Target("vs2010")]
18 public class VS2010Target : VSGenericTarget 18 public class VS2010Target : VSGenericTarget
19 { 19 {
20 #region Fields 20 #region Fields
21 21
22 string solutionVersion = "11.00"; 22 string solutionVersion = "11.00";
23 string productVersion = "9.0.30729"; 23 string productVersion = "9.0.30729";
24 string schemaVersion = "2.0"; 24 string schemaVersion = "2.0";
25 string versionName = "Visual Studio 2010"; 25 string versionName = "Visual Studio 2010";
26 string name = "vs2010"; 26 string name = "vs2010";
27 VSVersion version = VSVersion.VS10; 27 VSVersion version = VSVersion.VS10;
28 28
29 #endregion 29 #endregion
30 30
31 #region Properties 31 #region Properties
32 32
33 /// <summary> 33 /// <summary>
34 /// Gets or sets the solution version. 34 /// Gets or sets the solution version.
35 /// </summary> 35 /// </summary>
36 /// <value>The solution version.</value> 36 /// <value>The solution version.</value>
37 public override string SolutionVersion 37 public override string SolutionVersion
38 { 38 {
39 get 39 get
40 { 40 {
41 return solutionVersion; 41 return solutionVersion;
42 } 42 }
43 } 43 }
44 44
45 /// <summary> 45 /// <summary>
46 /// Gets or sets the product version. 46 /// Gets or sets the product version.
47 /// </summary> 47 /// </summary>
48 /// <value>The product version.</value> 48 /// <value>The product version.</value>
49 public override string ProductVersion 49 public override string ProductVersion
50 { 50 {
51 get 51 get
52 { 52 {
53 return productVersion; 53 return productVersion;
54 } 54 }
55 } 55 }
56 56
57 /// <summary> 57 /// <summary>
58 /// Gets or sets the schema version. 58 /// Gets or sets the schema version.
59 /// </summary> 59 /// </summary>
60 /// <value>The schema version.</value> 60 /// <value>The schema version.</value>
61 public override string SchemaVersion 61 public override string SchemaVersion
62 { 62 {
63 get 63 get
64 { 64 {
65 return schemaVersion; 65 return schemaVersion;
66 } 66 }
67 } 67 }
68 68
69 /// <summary> 69 /// <summary>
70 /// Gets or sets the name of the version. 70 /// Gets or sets the name of the version.
71 /// </summary> 71 /// </summary>
72 /// <value>The name of the version.</value> 72 /// <value>The name of the version.</value>
73 public override string VersionName 73 public override string VersionName
74 { 74 {
75 get 75 get
76 { 76 {
77 return versionName; 77 return versionName;
78 } 78 }
79 } 79 }
80 80
81 /// <summary> 81 /// <summary>
82 /// Gets or sets the version. 82 /// Gets or sets the version.
83 /// </summary> 83 /// </summary>
84 /// <value>The version.</value> 84 /// <value>The version.</value>
85 public override VSVersion Version 85 public override VSVersion Version
86 { 86 {
87 get 87 get
88 { 88 {
89 return version; 89 return version;
90 } 90 }
91 } 91 }
92 92
93 /// <summary> 93 /// <summary>
94 /// Gets the name. 94 /// Gets the name.
95 /// </summary> 95 /// </summary>
96 /// <value>The name.</value> 96 /// <value>The name.</value>
97 public override string Name 97 public override string Name
98 { 98 {
99 get 99 get
100 { 100 {
101 return name; 101 return name;
102 } 102 }
103 } 103 }
104 104
105 protected override string GetToolsVersionXml(FrameworkVersion frameworkVersion) 105 protected override string GetToolsVersionXml(FrameworkVersion frameworkVersion)
106 { 106 {
@@ -110,7 +110,7 @@ namespace Prebuild.Core.Targets
110 case FrameworkVersion.v4_5: 110 case FrameworkVersion.v4_5:
111 case FrameworkVersion.v4_0: 111 case FrameworkVersion.v4_0:
112 case FrameworkVersion.v3_5: 112 case FrameworkVersion.v3_5:
113 return "ToolsVersion=\"4.0\""; 113 return "ToolsVersion=\"4.0\"";
114 case FrameworkVersion.v3_0: 114 case FrameworkVersion.v3_0:
115 return "ToolsVersion=\"3.0\""; 115 return "ToolsVersion=\"3.0\"";
116 default: 116 default:
@@ -123,18 +123,18 @@ namespace Prebuild.Core.Targets
123 get { return "# Visual Studio 2010"; } 123 get { return "# Visual Studio 2010"; }
124 } 124 }
125 125
126 #endregion 126 #endregion
127 127
128 #region Constructors 128 #region Constructors
129 129
130 /// <summary> 130 /// <summary>
131 /// Initializes a new instance of the <see cref="VS2005Target"/> class. 131 /// Initializes a new instance of the <see cref="VS2005Target"/> class.
132 /// </summary> 132 /// </summary>
133 public VS2010Target() 133 public VS2010Target()
134 : base() 134 : base()
135 { 135 {
136 } 136 }
137 137
138 #endregion 138 #endregion
139 } 139 }
140} 140}
diff --git a/Prebuild/src/Core/Targets/VSGenericTarget.cs b/Prebuild/src/Core/Targets/VSGenericTarget.cs
index 400788b..b8904ad 100644
--- a/Prebuild/src/Core/Targets/VSGenericTarget.cs
+++ b/Prebuild/src/Core/Targets/VSGenericTarget.cs
@@ -35,141 +35,141 @@ using System.CodeDom.Compiler;
35namespace Prebuild.Core.Targets 35namespace Prebuild.Core.Targets
36{ 36{
37 37
38 /// <summary> 38 /// <summary>
39 /// 39 ///
40 /// </summary> 40 /// </summary>
41 public abstract class VSGenericTarget : ITarget 41 public abstract class VSGenericTarget : ITarget
42 { 42 {
43 #region Fields 43 #region Fields
44 44
45 readonly Dictionary<string, ToolInfo> tools = new Dictionary<string, ToolInfo>(); 45 readonly Dictionary<string, ToolInfo> tools = new Dictionary<string, ToolInfo>();
46// NameValueCollection CopyFiles = new NameValueCollection(); 46// NameValueCollection CopyFiles = new NameValueCollection();
47 Kernel kernel; 47 Kernel kernel;
48 #endregion 48 #endregion
49 49
50 #region Properties 50 #region Properties
51 /// <summary> 51 /// <summary>
52 /// Gets or sets the solution version. 52 /// Gets or sets the solution version.
53 /// </summary> 53 /// </summary>
54 /// <value>The solution version.</value> 54 /// <value>The solution version.</value>
55 public abstract string SolutionVersion { get; } 55 public abstract string SolutionVersion { get; }
56 /// <summary> 56 /// <summary>
57 /// Gets or sets the product version. 57 /// Gets or sets the product version.
58 /// </summary> 58 /// </summary>
59 /// <value>The product version.</value> 59 /// <value>The product version.</value>
60 public abstract string ProductVersion { get; } 60 public abstract string ProductVersion { get; }
61 /// <summary> 61 /// <summary>
62 /// Gets or sets the schema version. 62 /// Gets or sets the schema version.
63 /// </summary> 63 /// </summary>
64 /// <value>The schema version.</value> 64 /// <value>The schema version.</value>
65 public abstract string SchemaVersion { get; } 65 public abstract string SchemaVersion { get; }
66 /// <summary> 66 /// <summary>
67 /// Gets or sets the name of the version. 67 /// Gets or sets the name of the version.
68 /// </summary> 68 /// </summary>
69 /// <value>The name of the version.</value> 69 /// <value>The name of the version.</value>
70 public abstract string VersionName { get; } 70 public abstract string VersionName { get; }
71 /// <summary> 71 /// <summary>
72 /// Gets or sets the version. 72 /// Gets or sets the version.
73 /// </summary> 73 /// </summary>
74 /// <value>The version.</value> 74 /// <value>The version.</value>
75 public abstract VSVersion Version { get; } 75 public abstract VSVersion Version { get; }
76 /// <summary> 76 /// <summary>
77 /// Gets the name. 77 /// Gets the name.
78 /// </summary> 78 /// </summary>
79 /// <value>The name.</value> 79 /// <value>The name.</value>
80 public abstract string Name { get; } 80 public abstract string Name { get; }
81 81
82 protected abstract string GetToolsVersionXml(FrameworkVersion version); 82 protected abstract string GetToolsVersionXml(FrameworkVersion version);
83 public abstract string SolutionTag { get; } 83 public abstract string SolutionTag { get; }
84 84
85 #endregion 85 #endregion
86 86
87 #region Constructors 87 #region Constructors
88 88
89 /// <summary> 89 /// <summary>
90 /// Initializes a new instance of the <see cref="VSGenericTarget"/> class. 90 /// Initializes a new instance of the <see cref="VSGenericTarget"/> class.
91 /// </summary> 91 /// </summary>
92 protected VSGenericTarget() 92 protected VSGenericTarget()
93 { 93 {
94 tools["C#"] = new ToolInfo("C#", "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}", "csproj", "CSHARP", "$(MSBuildBinPath)\\Microsoft.CSHARP.Targets"); 94 tools["C#"] = new ToolInfo("C#", "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}", "csproj", "CSHARP", "$(MSBuildBinPath)\\Microsoft.CSHARP.Targets");
95 tools["Database"] = new ToolInfo("Database", "{4F174C21-8C12-11D0-8340-0000F80270F8}", "dbp", "UNKNOWN"); 95 tools["Database"] = new ToolInfo("Database", "{4F174C21-8C12-11D0-8340-0000F80270F8}", "dbp", "UNKNOWN");
96 tools["Boo"] = new ToolInfo("Boo", "{45CEA7DC-C2ED-48A6-ACE0-E16144C02365}", "booproj", "Boo", "$(BooBinPath)\\Boo.Microsoft.Build.targets"); 96 tools["Boo"] = new ToolInfo("Boo", "{45CEA7DC-C2ED-48A6-ACE0-E16144C02365}", "booproj", "Boo", "$(BooBinPath)\\Boo.Microsoft.Build.targets");
97 tools["VisualBasic"] = new ToolInfo("VisualBasic", "{F184B08F-C81C-45F6-A57F-5ABD9991F28F}", "vbproj", "VisualBasic", "$(MSBuildBinPath)\\Microsoft.VisualBasic.Targets"); 97 tools["VisualBasic"] = new ToolInfo("VisualBasic", "{F184B08F-C81C-45F6-A57F-5ABD9991F28F}", "vbproj", "VisualBasic", "$(MSBuildBinPath)\\Microsoft.VisualBasic.Targets");
98 tools["Folder"] = new ToolInfo("Folder", "{2150E333-8FDC-42A3-9474-1A3956D46DE8}", null, null); 98 tools["Folder"] = new ToolInfo("Folder", "{2150E333-8FDC-42A3-9474-1A3956D46DE8}", null, null);
99 } 99 }
100 100
101 #endregion 101 #endregion
102 102
103 #region Private Methods 103 #region Private Methods
104 104
105 private string MakeRefPath(ProjectNode project) 105 private string MakeRefPath(ProjectNode project)
106 { 106 {
107 string ret = ""; 107 string ret = "";
108 foreach (ReferencePathNode node in project.ReferencePaths) 108 foreach (ReferencePathNode node in project.ReferencePaths)
109 { 109 {
110 try 110 try
111 { 111 {
112 string fullPath = Helper.ResolvePath(node.Path); 112 string fullPath = Helper.ResolvePath(node.Path);
113 if (ret.Length < 1) 113 if (ret.Length < 1)
114 { 114 {
115 ret = fullPath; 115 ret = fullPath;
116 } 116 }
117 else 117 else
118 { 118 {
119 ret += ";" + fullPath; 119 ret += ";" + fullPath;
120 } 120 }
121 } 121 }
122 catch (ArgumentException) 122 catch (ArgumentException)
123 { 123 {
124 kernel.Log.Write(LogType.Warning, "Could not resolve reference path: {0}", node.Path); 124 kernel.Log.Write(LogType.Warning, "Could not resolve reference path: {0}", node.Path);
125 } 125 }
126 } 126 }
127 127
128 return ret; 128 return ret;
129 } 129 }
130 130
131 private static ProjectNode FindProjectInSolution(string name, SolutionNode solution) 131 private static ProjectNode FindProjectInSolution(string name, SolutionNode solution)
132 { 132 {
133 SolutionNode node = solution; 133 SolutionNode node = solution;
134 134
135 while (node.Parent is SolutionNode) 135 while (node.Parent is SolutionNode)
136 node = node.Parent as SolutionNode; 136 node = node.Parent as SolutionNode;
137 137
138 return FindProjectInSolutionRecursively(name, node); 138 return FindProjectInSolutionRecursively(name, node);
139 } 139 }
140 140
141 private static ProjectNode FindProjectInSolutionRecursively(string name, SolutionNode solution) 141 private static ProjectNode FindProjectInSolutionRecursively(string name, SolutionNode solution)
142 { 142 {
143 if (solution.ProjectsTable.ContainsKey(name)) 143 if (solution.ProjectsTable.ContainsKey(name))
144 return solution.ProjectsTable[name]; 144 return solution.ProjectsTable[name];
145 145
146 foreach (SolutionNode child in solution.Solutions) 146 foreach (SolutionNode child in solution.Solutions)
147 { 147 {
148 ProjectNode node = FindProjectInSolutionRecursively(name, child); 148 ProjectNode node = FindProjectInSolutionRecursively(name, child);
149 if (node != null) 149 if (node != null)
150 return node; 150 return node;
151 } 151 }
152 152
153 return null; 153 return null;
154 } 154 }
155 155
156 private void WriteProject(SolutionNode solution, ProjectNode project) 156 private void WriteProject(SolutionNode solution, ProjectNode project)
157 { 157 {
158 if (!tools.ContainsKey(project.Language)) 158 if (!tools.ContainsKey(project.Language))
159 { 159 {
160 throw new UnknownLanguageException("Unknown .NET language: " + project.Language); 160 throw new UnknownLanguageException("Unknown .NET language: " + project.Language);
161 } 161 }
162 162
163 ToolInfo toolInfo = tools[project.Language]; 163 ToolInfo toolInfo = tools[project.Language];
164 string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, toolInfo.FileExtension); 164 string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, toolInfo.FileExtension);
165 StreamWriter ps = new StreamWriter(projectFile); 165 StreamWriter ps = new StreamWriter(projectFile);
166 166
167 kernel.CurrentWorkingDirectory.Push(); 167 kernel.CurrentWorkingDirectory.Push();
168 Helper.SetCurrentDir(Path.GetDirectoryName(projectFile)); 168 Helper.SetCurrentDir(Path.GetDirectoryName(projectFile));
169 169
170 #region Project File 170 #region Project File
171 using (ps) 171 using (ps)
172 { 172 {
173 string targets = ""; 173 string targets = "";
174 174
175 if(project.Files.CopyFiles > 0) 175 if(project.Files.CopyFiles > 0)
@@ -177,347 +177,353 @@ namespace Prebuild.Core.Targets
177 else 177 else
178 targets = "Build"; 178 targets = "Build";
179 179
180 ps.WriteLine("<Project DefaultTargets=\"{0}\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\" {1}>", targets, GetToolsVersionXml(project.FrameworkVersion)); 180 ps.WriteLine("<Project DefaultTargets=\"{0}\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\" {1}>", targets, GetToolsVersionXml(project.FrameworkVersion));
181 ps.WriteLine(" <PropertyGroup>"); 181 ps.WriteLine(" <PropertyGroup>");
182 ps.WriteLine(" <ProjectType>Local</ProjectType>"); 182 ps.WriteLine(" <ProjectType>Local</ProjectType>");
183 ps.WriteLine(" <ProductVersion>{0}</ProductVersion>", ProductVersion); 183 ps.WriteLine(" <ProductVersion>{0}</ProductVersion>", ProductVersion);
184 ps.WriteLine(" <SchemaVersion>{0}</SchemaVersion>", SchemaVersion); 184 ps.WriteLine(" <SchemaVersion>{0}</SchemaVersion>", SchemaVersion);
185 ps.WriteLine(" <ProjectGuid>{{{0}}}</ProjectGuid>", project.Guid.ToString().ToUpper()); 185 ps.WriteLine(" <ProjectGuid>{{{0}}}</ProjectGuid>", project.Guid.ToString().ToUpper());
186 186
187 // Visual Studio has a hard coded guid for the project type 187 // Visual Studio has a hard coded guid for the project type
188 if (project.Type == ProjectType.Web) 188 if (project.Type == ProjectType.Web)
189 ps.WriteLine(" <ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>"); 189 ps.WriteLine(" <ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>");
190 ps.WriteLine(" <Configuration Condition=\" '$(Configuration)' == '' \">Debug</Configuration>"); 190 ps.WriteLine(" <Configuration Condition=\" '$(Configuration)' == '' \">Debug</Configuration>");
191 ps.WriteLine(" <ApplicationIcon>{0}</ApplicationIcon>", project.AppIcon); 191 ps.WriteLine(" <ApplicationIcon>{0}</ApplicationIcon>", project.AppIcon);
192 ps.WriteLine(" <AssemblyKeyContainerName>"); 192 ps.WriteLine(" <AssemblyKeyContainerName>");
193 ps.WriteLine(" </AssemblyKeyContainerName>"); 193 ps.WriteLine(" </AssemblyKeyContainerName>");
194 ps.WriteLine(" <AssemblyName>{0}</AssemblyName>", project.AssemblyName); 194 ps.WriteLine(" <AssemblyName>{0}</AssemblyName>", project.AssemblyName);
195 foreach (ConfigurationNode conf in project.Configurations) 195 foreach (ConfigurationNode conf in project.Configurations)
196 {
197 if (conf.Options.KeyFile != "")
198 {
199 ps.WriteLine(" <AssemblyOriginatorKeyFile>{0}</AssemblyOriginatorKeyFile>", conf.Options.KeyFile);
200 ps.WriteLine(" <SignAssembly>true</SignAssembly>");
201 break;
202 }
203 }
204 ps.WriteLine(" <DefaultClientScript>JScript</DefaultClientScript>");
205 ps.WriteLine(" <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>");
206 ps.WriteLine(" <DefaultTargetSchema>IE50</DefaultTargetSchema>");
207 ps.WriteLine(" <DelaySign>false</DelaySign>");
208 ps.WriteLine(" <TargetFrameworkVersion>{0}</TargetFrameworkVersion>", project.FrameworkVersion.ToString().Replace("_", "."));
209
210 ps.WriteLine(" <OutputType>{0}</OutputType>", project.Type == ProjectType.Web ? ProjectType.Library.ToString() : project.Type.ToString());
211 ps.WriteLine(" <AppDesignerFolder>{0}</AppDesignerFolder>", project.DesignerFolder);
212 ps.WriteLine(" <RootNamespace>{0}</RootNamespace>", project.RootNamespace);
213 ps.WriteLine(" <StartupObject>{0}</StartupObject>", project.StartupObject);
214 if (string.IsNullOrEmpty(project.DebugStartParameters))
215 {
216 ps.WriteLine(" <StartArguments>{0}</StartArguments>", project.DebugStartParameters);
217 }
218 ps.WriteLine(" <FileUpgradeFlags>");
219 ps.WriteLine(" </FileUpgradeFlags>");
220
221 ps.WriteLine(" </PropertyGroup>");
222 if (!string.IsNullOrEmpty(project.ApplicationManifest))
196 { 223 {
197 if (conf.Options.KeyFile != "") 224 ps.WriteLine(" <PropertyGroup>");
198 { 225 ps.WriteLine(" <ApplicationManifest>" + project.ApplicationManifest + "</ApplicationManifest>");
199 ps.WriteLine(" <AssemblyOriginatorKeyFile>{0}</AssemblyOriginatorKeyFile>", conf.Options.KeyFile);
200 ps.WriteLine(" <SignAssembly>true</SignAssembly>");
201 break;
202 }
203 }
204 ps.WriteLine(" <DefaultClientScript>JScript</DefaultClientScript>");
205 ps.WriteLine(" <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>");
206 ps.WriteLine(" <DefaultTargetSchema>IE50</DefaultTargetSchema>");
207 ps.WriteLine(" <DelaySign>false</DelaySign>");
208 ps.WriteLine(" <TargetFrameworkVersion>{0}</TargetFrameworkVersion>", project.FrameworkVersion.ToString().Replace("_", "."));
209
210 ps.WriteLine(" <OutputType>{0}</OutputType>", project.Type == ProjectType.Web ? ProjectType.Library.ToString() : project.Type.ToString());
211 ps.WriteLine(" <AppDesignerFolder>{0}</AppDesignerFolder>", project.DesignerFolder);
212 ps.WriteLine(" <RootNamespace>{0}</RootNamespace>", project.RootNamespace);
213 ps.WriteLine(" <StartupObject>{0}</StartupObject>", project.StartupObject);
214 if (string.IsNullOrEmpty(project.DebugStartParameters))
215 {
216 ps.WriteLine(" <StartArguments>{0}</StartArguments>", project.DebugStartParameters);
217 }
218 ps.WriteLine(" <FileUpgradeFlags>");
219 ps.WriteLine(" </FileUpgradeFlags>");
220
221 ps.WriteLine(" </PropertyGroup>");
222
223 foreach (ConfigurationNode conf in project.Configurations)
224 {
225 ps.Write(" <PropertyGroup ");
226 ps.WriteLine("Condition=\" '$(Configuration)|$(Platform)' == '{0}|{1}' \">", conf.Name, conf.Platform);
227 ps.WriteLine(" <AllowUnsafeBlocks>{0}</AllowUnsafeBlocks>", conf.Options["AllowUnsafe"]);
228 ps.WriteLine(" <BaseAddress>{0}</BaseAddress>", conf.Options["BaseAddress"]);
229 ps.WriteLine(" <CheckForOverflowUnderflow>{0}</CheckForOverflowUnderflow>", conf.Options["CheckUnderflowOverflow"]);
230 ps.WriteLine(" <ConfigurationOverrideFile>");
231 ps.WriteLine(" </ConfigurationOverrideFile>");
232 ps.WriteLine(" <DefineConstants>{0}</DefineConstants>", conf.Options["CompilerDefines"]);
233 ps.WriteLine(" <DocumentationFile>{0}</DocumentationFile>", Helper.NormalizePath(conf.Options["XmlDocFile"].ToString()));
234 ps.WriteLine(" <DebugSymbols>{0}</DebugSymbols>", conf.Options["DebugInformation"]);
235 ps.WriteLine(" <FileAlignment>{0}</FileAlignment>", conf.Options["FileAlignment"]);
236 ps.WriteLine(" <Optimize>{0}</Optimize>", conf.Options["OptimizeCode"]);
237 if (project.Type != ProjectType.Web)
238 ps.WriteLine(" <OutputPath>{0}</OutputPath>",
239 Helper.EndPath(Helper.NormalizePath(conf.Options["OutputPath"].ToString())));
240 else
241 ps.WriteLine(" <OutputPath>{0}</OutputPath>",
242 Helper.EndPath(Helper.NormalizePath("bin\\")));
243
244 ps.WriteLine(" <RegisterForComInterop>{0}</RegisterForComInterop>", conf.Options["RegisterComInterop"]);
245 ps.WriteLine(" <RemoveIntegerChecks>{0}</RemoveIntegerChecks>", conf.Options["RemoveIntegerChecks"]);
246 ps.WriteLine(" <TreatWarningsAsErrors>{0}</TreatWarningsAsErrors>", conf.Options["WarningsAsErrors"]);
247 ps.WriteLine(" <WarningLevel>{0}</WarningLevel>", conf.Options["WarningLevel"]);
248 ps.WriteLine(" <NoStdLib>{0}</NoStdLib>", conf.Options["NoStdLib"]);
249 ps.WriteLine(" <NoWarn>{0}</NoWarn>", conf.Options["SuppressWarnings"]);
250 ps.WriteLine(" <PlatformTarget>{0}</PlatformTarget>", conf.Platform);
251 ps.WriteLine(" </PropertyGroup>"); 226 ps.WriteLine(" </PropertyGroup>");
252 } 227 }
253 228 foreach (ConfigurationNode conf in project.Configurations)
254 //ps.WriteLine(" </Settings>"); 229 {
255 230 ps.Write(" <PropertyGroup ");
256 Dictionary<ReferenceNode, ProjectNode> projectReferences = new Dictionary<ReferenceNode, ProjectNode>(); 231 ps.WriteLine("Condition=\" '$(Configuration)|$(Platform)' == '{0}|{1}' \">", conf.Name, conf.Platform);
257 List<ReferenceNode> otherReferences = new List<ReferenceNode>(); 232 ps.WriteLine(" <AllowUnsafeBlocks>{0}</AllowUnsafeBlocks>", conf.Options["AllowUnsafe"]);
258 233 ps.WriteLine(" <BaseAddress>{0}</BaseAddress>", conf.Options["BaseAddress"]);
259 foreach (ReferenceNode refr in project.References) 234 ps.WriteLine(" <CheckForOverflowUnderflow>{0}</CheckForOverflowUnderflow>", conf.Options["CheckUnderflowOverflow"]);
260 { 235 ps.WriteLine(" <ConfigurationOverrideFile>");
261 ProjectNode projectNode = FindProjectInSolution(refr.Name, solution); 236 ps.WriteLine(" </ConfigurationOverrideFile>");
262 237 ps.WriteLine(" <DefineConstants>{0}</DefineConstants>",
263 if (projectNode == null) 238 conf.Options["CompilerDefines"] == "" ? this.kernel.ForcedConditionals : conf.Options["CompilerDefines"] + ";" + kernel.ForcedConditionals);
264 otherReferences.Add(refr); 239 ps.WriteLine(" <DocumentationFile>{0}</DocumentationFile>", Helper.NormalizePath(conf.Options["XmlDocFile"].ToString()));
265 else 240 ps.WriteLine(" <DebugSymbols>{0}</DebugSymbols>", conf.Options["DebugInformation"]);
266 projectReferences.Add(refr, projectNode); 241 ps.WriteLine(" <FileAlignment>{0}</FileAlignment>", conf.Options["FileAlignment"]);
267 } 242 ps.WriteLine(" <Optimize>{0}</Optimize>", conf.Options["OptimizeCode"]);
268 // Assembly References 243 if (project.Type != ProjectType.Web)
269 ps.WriteLine(" <ItemGroup>"); 244 ps.WriteLine(" <OutputPath>{0}</OutputPath>",
270 245 Helper.EndPath(Helper.NormalizePath(conf.Options["OutputPath"].ToString())));
271 foreach (ReferenceNode refr in otherReferences) 246 else
272 { 247 ps.WriteLine(" <OutputPath>{0}</OutputPath>",
273 ps.Write(" <Reference"); 248 Helper.EndPath(Helper.NormalizePath("bin\\")));
274 ps.Write(" Include=\""); 249
275 ps.Write(refr.Name); 250 ps.WriteLine(" <RegisterForComInterop>{0}</RegisterForComInterop>", conf.Options["RegisterComInterop"]);
276 ps.WriteLine("\" >"); 251 ps.WriteLine(" <RemoveIntegerChecks>{0}</RemoveIntegerChecks>", conf.Options["RemoveIntegerChecks"]);
277 ps.Write(" <Name>"); 252 ps.WriteLine(" <TreatWarningsAsErrors>{0}</TreatWarningsAsErrors>", conf.Options["WarningsAsErrors"]);
278 ps.Write(refr.Name); 253 ps.WriteLine(" <WarningLevel>{0}</WarningLevel>", conf.Options["WarningLevel"]);
279 ps.WriteLine("</Name>"); 254 ps.WriteLine(" <NoStdLib>{0}</NoStdLib>", conf.Options["NoStdLib"]);
280 255 ps.WriteLine(" <NoWarn>{0}</NoWarn>", conf.Options["SuppressWarnings"]);
281 if(!String.IsNullOrEmpty(refr.Path)) 256 ps.WriteLine(" <PlatformTarget>{0}</PlatformTarget>", conf.Platform);
282 { 257 ps.WriteLine(" </PropertyGroup>");
283 // Use absolute path to assembly (for determining assembly type) 258 }
284 string absolutePath = Path.Combine(project.FullPath, refr.Path); 259
285 if(File.Exists(Helper.MakeFilePath(absolutePath, refr.Name, "exe"))) { 260 //ps.WriteLine(" </Settings>");
286 // Assembly is an executable (exe) 261
287 ps.WriteLine(" <HintPath>{0}</HintPath>", Helper.MakeFilePath(refr.Path, refr.Name, "exe")); 262 Dictionary<ReferenceNode, ProjectNode> projectReferences = new Dictionary<ReferenceNode, ProjectNode>();
288 } else if(File.Exists(Helper.MakeFilePath(absolutePath, refr.Name, "dll"))) { 263 List<ReferenceNode> otherReferences = new List<ReferenceNode>();
289 // Assembly is an library (dll) 264
290 ps.WriteLine(" <HintPath>{0}</HintPath>", Helper.MakeFilePath(refr.Path, refr.Name, "dll")); 265 foreach (ReferenceNode refr in project.References)
291 } else { 266 {
292 string referencePath = Helper.MakeFilePath(refr.Path, refr.Name, "dll"); 267 ProjectNode projectNode = FindProjectInSolution(refr.Name, solution);
293 kernel.Log.Write(LogType.Warning, "Reference \"{0}\": The specified file doesn't exist.", referencePath); 268
294 ps.WriteLine(" <HintPath>{0}</HintPath>", Helper.MakeFilePath(refr.Path, refr.Name, "dll")); 269 if (projectNode == null)
295 } 270 otherReferences.Add(refr);
296 } 271 else
297 272 projectReferences.Add(refr, projectNode);
298 ps.WriteLine(" <Private>{0}</Private>", refr.LocalCopy); 273 }
299 ps.WriteLine(" </Reference>"); 274 // Assembly References
300 } 275 ps.WriteLine(" <ItemGroup>");
301 ps.WriteLine(" </ItemGroup>"); 276
302 277 foreach (ReferenceNode refr in otherReferences)
303 //Project References 278 {
304 ps.WriteLine(" <ItemGroup>"); 279 ps.Write(" <Reference");
305 foreach (KeyValuePair<ReferenceNode, ProjectNode> pair in projectReferences) 280 ps.Write(" Include=\"");
306 { 281 ps.Write(refr.Name);
307 ToolInfo tool = tools[pair.Value.Language]; 282 ps.WriteLine("\" >");
308 if (tools == null) 283 ps.Write(" <Name>");
309 throw new UnknownLanguageException(); 284 ps.Write(refr.Name);
310 285 ps.WriteLine("</Name>");
311 string path = 286
312 Helper.MakePathRelativeTo(project.FullPath, 287 if(!String.IsNullOrEmpty(refr.Path))
313 Helper.MakeFilePath(pair.Value.FullPath, pair.Value.Name, tool.FileExtension)); 288 {
314 ps.WriteLine(" <ProjectReference Include=\"{0}\">", path); 289 // Use absolute path to assembly (for determining assembly type)
315 290 string absolutePath = Path.Combine(project.FullPath, refr.Path);
316 // TODO: Allow reference to visual basic projects 291 if(File.Exists(Helper.MakeFilePath(absolutePath, refr.Name, "exe"))) {
317 ps.WriteLine(" <Name>{0}</Name>", pair.Value.Name); 292 // Assembly is an executable (exe)
318 ps.WriteLine(" <Project>{0}</Project>", pair.Value.Guid.ToString("B").ToUpper()); 293 ps.WriteLine(" <HintPath>{0}</HintPath>", Helper.MakeFilePath(refr.Path, refr.Name, "exe"));
319 ps.WriteLine(" <Package>{0}</Package>", tool.Guid.ToUpper()); 294 } else if(File.Exists(Helper.MakeFilePath(absolutePath, refr.Name, "dll"))) {
320 295 // Assembly is an library (dll)
321 //This is the Copy Local flag in VS 296 ps.WriteLine(" <HintPath>{0}</HintPath>", Helper.MakeFilePath(refr.Path, refr.Name, "dll"));
322 ps.WriteLine(" <Private>{0}</Private>", pair.Key.LocalCopy); 297 } else {
323 298 string referencePath = Helper.MakeFilePath(refr.Path, refr.Name, "dll");
324 ps.WriteLine(" </ProjectReference>"); 299 kernel.Log.Write(LogType.Warning, "Reference \"{0}\": The specified file doesn't exist.", referencePath);
325 } 300 ps.WriteLine(" <HintPath>{0}</HintPath>", Helper.MakeFilePath(refr.Path, refr.Name, "dll"));
326 ps.WriteLine(" </ItemGroup>"); 301 }
327 302 }
328 // ps.WriteLine(" </Build>"); 303
329 ps.WriteLine(" <ItemGroup>"); 304 ps.WriteLine(" <Private>{0}</Private>", refr.LocalCopy);
330 305 ps.WriteLine(" </Reference>");
331 // ps.WriteLine(" <Include>"); 306 }
332 List<string> list = new List<string>(); 307 ps.WriteLine(" </ItemGroup>");
333 308
334 foreach (string path in project.Files) 309 //Project References
335 { 310 ps.WriteLine(" <ItemGroup>");
336 string lower = path.ToLower(); 311 foreach (KeyValuePair<ReferenceNode, ProjectNode> pair in projectReferences)
337 if (lower.EndsWith(".resx")) 312 {
338 { 313 ToolInfo tool = tools[pair.Value.Language];
339 string codebehind = String.Format("{0}.Designer{1}", path.Substring(0, path.LastIndexOf('.')), toolInfo.LanguageExtension); 314 if (tools == null)
340 if (!list.Contains(codebehind)) 315 throw new UnknownLanguageException();
341 list.Add(codebehind); 316
342 } 317 string path =
343 318 Helper.MakePathRelativeTo(project.FullPath,
344 } 319 Helper.MakeFilePath(pair.Value.FullPath, pair.Value.Name, tool.FileExtension));
345 320 ps.WriteLine(" <ProjectReference Include=\"{0}\">", path);
346 321
347 foreach (string filePath in project.Files) 322 // TODO: Allow reference to visual basic projects
348 { 323 ps.WriteLine(" <Name>{0}</Name>", pair.Value.Name);
324 ps.WriteLine(" <Project>{0}</Project>", pair.Value.Guid.ToString("B").ToUpper());
325 ps.WriteLine(" <Package>{0}</Package>", tool.Guid.ToUpper());
326
327 //This is the Copy Local flag in VS
328 ps.WriteLine(" <Private>{0}</Private>", pair.Key.LocalCopy);
329
330 ps.WriteLine(" </ProjectReference>");
331 }
332 ps.WriteLine(" </ItemGroup>");
333
334 // ps.WriteLine(" </Build>");
335 ps.WriteLine(" <ItemGroup>");
336
337 // ps.WriteLine(" <Include>");
338 List<string> list = new List<string>();
339
340 foreach (string path in project.Files)
341 {
342 string lower = path.ToLower();
343 if (lower.EndsWith(".resx"))
344 {
345 string codebehind = String.Format("{0}.Designer{1}", path.Substring(0, path.LastIndexOf('.')), toolInfo.LanguageExtension);
346 if (!list.Contains(codebehind))
347 list.Add(codebehind);
348 }
349
350 }
351
352
353 foreach (string filePath in project.Files)
354 {
349 // Add the filePath with the destination as the key 355 // Add the filePath with the destination as the key
350 // will use it later to form the copy parameters with Include lists 356 // will use it later to form the copy parameters with Include lists
351 // for each destination 357 // for each destination
352 if (project.Files.GetBuildAction(filePath) == BuildAction.Copy) 358 if (project.Files.GetBuildAction(filePath) == BuildAction.Copy)
353 continue; 359 continue;
354 // if (file == "Properties\\Bind.Designer.cs") 360 // if (file == "Properties\\Bind.Designer.cs")
355 // { 361 // {
356 // Console.WriteLine("Wait a minute!"); 362 // Console.WriteLine("Wait a minute!");
357 // Console.WriteLine(project.Files.GetSubType(file).ToString()); 363 // Console.WriteLine(project.Files.GetSubType(file).ToString());
358 // } 364 // }
359 SubType subType = project.Files.GetSubType(filePath); 365 SubType subType = project.Files.GetSubType(filePath);
360 366
361 // Visual Studio chokes on file names if forward slash is used as a path separator 367 // Visual Studio chokes on file names if forward slash is used as a path separator
362 // instead of backslash. So we must make sure that all file paths written to the 368 // instead of backslash. So we must make sure that all file paths written to the
363 // project file use \ as a path separator. 369 // project file use \ as a path separator.
364 string file = filePath.Replace(@"/", @"\"); 370 string file = filePath.Replace(@"/", @"\");
365 371
366 if (subType != SubType.Code && subType != SubType.Settings && subType != SubType.Designer 372 if (subType != SubType.Code && subType != SubType.Settings && subType != SubType.Designer
367 && subType != SubType.CodeBehind) 373 && subType != SubType.CodeBehind)
368 { 374 {
369 ps.WriteLine(" <EmbeddedResource Include=\"{0}\">", file.Substring(0, file.LastIndexOf('.')) + ".resx"); 375 ps.WriteLine(" <EmbeddedResource Include=\"{0}\">", file.Substring(0, file.LastIndexOf('.')) + ".resx");
370 ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", Path.GetFileName(file)); 376 ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", Path.GetFileName(file));
371 ps.WriteLine(" <SubType>Designer</SubType>"); 377 ps.WriteLine(" <SubType>Designer</SubType>");
372 ps.WriteLine(" </EmbeddedResource>"); 378 ps.WriteLine(" </EmbeddedResource>");
373 // 379 //
374 } 380 }
375 381
376 if (subType == SubType.Designer) 382 if (subType == SubType.Designer)
377 { 383 {
378 ps.WriteLine(" <EmbeddedResource Include=\"{0}\">", file); 384 ps.WriteLine(" <EmbeddedResource Include=\"{0}\">", file);
379 385
380 string autogen_name = file.Substring(0, file.LastIndexOf('.')) + ".Designer.cs"; 386 string autogen_name = file.Substring(0, file.LastIndexOf('.')) + ".Designer.cs";
381 string dependent_name = filePath.Substring(0, file.LastIndexOf('.')) + ".cs"; 387 string dependent_name = filePath.Substring(0, file.LastIndexOf('.')) + ".cs";
382 388
383 // Check for a parent .cs file with the same name as this designer file 389 // Check for a parent .cs file with the same name as this designer file
384 if (File.Exists(Helper.NormalizePath(dependent_name))) 390 if (File.Exists(Helper.NormalizePath(dependent_name)))
385 { 391 {
386 ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", Path.GetFileName(dependent_name)); 392 ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", Path.GetFileName(dependent_name));
387 } 393 }
388 else 394 else
389 { 395 {
390 ps.WriteLine(" <Generator>ResXFileCodeGenerator</Generator>"); 396 ps.WriteLine(" <Generator>ResXFileCodeGenerator</Generator>");
391 ps.WriteLine(" <LastGenOutput>{0}</LastGenOutput>", Path.GetFileName(autogen_name)); 397 ps.WriteLine(" <LastGenOutput>{0}</LastGenOutput>", Path.GetFileName(autogen_name));
392 ps.WriteLine(" <SubType>" + subType + "</SubType>"); 398 ps.WriteLine(" <SubType>" + subType + "</SubType>");
393 } 399 }
394 400
395 ps.WriteLine(" </EmbeddedResource>"); 401 ps.WriteLine(" </EmbeddedResource>");
396 if (File.Exists(Helper.NormalizePath(autogen_name))) 402 if (File.Exists(Helper.NormalizePath(autogen_name)))
397 { 403 {
398 ps.WriteLine(" <Compile Include=\"{0}\">", autogen_name); 404 ps.WriteLine(" <Compile Include=\"{0}\">", autogen_name);
399 //ps.WriteLine(" <DesignTime>True</DesignTime>"); 405 //ps.WriteLine(" <DesignTime>True</DesignTime>");
400 406
401 // If a parent .cs file exists, link this autogen file to it. Otherwise link 407 // If a parent .cs file exists, link this autogen file to it. Otherwise link
402 // to the designer file 408 // to the designer file
403 if (File.Exists(dependent_name)) 409 if (File.Exists(dependent_name))
404 { 410 {
405 ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", Path.GetFileName(dependent_name)); 411 ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", Path.GetFileName(dependent_name));
406 } 412 }
407 else 413 else
408 { 414 {
409 ps.WriteLine(" <AutoGen>True</AutoGen>"); 415 ps.WriteLine(" <AutoGen>True</AutoGen>");
410 ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", Path.GetFileName(filePath)); 416 ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", Path.GetFileName(filePath));
411 } 417 }
412 418
413 ps.WriteLine(" </Compile>"); 419 ps.WriteLine(" </Compile>");
414 } 420 }
415 list.Add(autogen_name); 421 list.Add(autogen_name);
416 } 422 }
417 if (subType == SubType.Settings) 423 if (subType == SubType.Settings)
418 { 424 {
419 ps.Write(" <{0} ", project.Files.GetBuildAction(filePath)); 425 ps.Write(" <{0} ", project.Files.GetBuildAction(filePath));
420 ps.WriteLine("Include=\"{0}\">", file); 426 ps.WriteLine("Include=\"{0}\">", file);
421 string fileName = Path.GetFileName(filePath); 427 string fileName = Path.GetFileName(filePath);
422 if (project.Files.GetBuildAction(filePath) == BuildAction.None) 428 if (project.Files.GetBuildAction(filePath) == BuildAction.None)
423 { 429 {
424 ps.WriteLine(" <Generator>SettingsSingleFileGenerator</Generator>"); 430 ps.WriteLine(" <Generator>SettingsSingleFileGenerator</Generator>");
425 ps.WriteLine(" <LastGenOutput>{0}</LastGenOutput>", fileName.Substring(0, fileName.LastIndexOf('.')) + ".Designer.cs"); 431 ps.WriteLine(" <LastGenOutput>{0}</LastGenOutput>", fileName.Substring(0, fileName.LastIndexOf('.')) + ".Designer.cs");
426 } 432 }
427 else 433 else
428 { 434 {
429 ps.WriteLine(" <SubType>Code</SubType>"); 435 ps.WriteLine(" <SubType>Code</SubType>");
430 ps.WriteLine(" <AutoGen>True</AutoGen>"); 436 ps.WriteLine(" <AutoGen>True</AutoGen>");
431 ps.WriteLine(" <DesignTimeSharedInput>True</DesignTimeSharedInput>"); 437 ps.WriteLine(" <DesignTimeSharedInput>True</DesignTimeSharedInput>");
432 string fileNameShort = fileName.Substring(0, fileName.LastIndexOf('.')); 438 string fileNameShort = fileName.Substring(0, fileName.LastIndexOf('.'));
433 string fileNameShorter = fileNameShort.Substring(0, fileNameShort.LastIndexOf('.')); 439 string fileNameShorter = fileNameShort.Substring(0, fileNameShort.LastIndexOf('.'));
434 ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", Path.GetFileName(fileNameShorter + ".settings")); 440 ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", Path.GetFileName(fileNameShorter + ".settings"));
435 } 441 }
436 ps.WriteLine(" </{0}>", project.Files.GetBuildAction(filePath)); 442 ps.WriteLine(" </{0}>", project.Files.GetBuildAction(filePath));
437 } 443 }
438 else if (subType != SubType.Designer) 444 else if (subType != SubType.Designer)
439 { 445 {
440 string path = Helper.NormalizePath(file); 446 string path = Helper.NormalizePath(file);
441 string path_lower = path.ToLower(); 447 string path_lower = path.ToLower();
442 448
443 if (!list.Contains(filePath)) 449 if (!list.Contains(filePath))
444 { 450 {
445 ps.Write(" <{0} ", project.Files.GetBuildAction(filePath)); 451 ps.Write(" <{0} ", project.Files.GetBuildAction(filePath));
446 452
447 int startPos = 0; 453 int startPos = 0;
448 if (project.Files.GetPreservePath(filePath)) 454 if (project.Files.GetPreservePath(filePath))
449 { 455 {
450 while ((@"./\").IndexOf(file.Substring(startPos, 1)) != -1) 456 while ((@"./\").IndexOf(file.Substring(startPos, 1)) != -1)
451 startPos++; 457 startPos++;
452 458
453 } 459 }
454 else 460 else
455 { 461 {
456 startPos = file.LastIndexOf(Path.GetFileName(path)); 462 startPos = file.LastIndexOf(Path.GetFileName(path));
457 } 463 }
458 464
459 // be sure to write out the path with backslashes so VS recognizes 465 // be sure to write out the path with backslashes so VS recognizes
460 // the file properly. 466 // the file properly.
461 ps.WriteLine("Include=\"{0}\">", file); 467 ps.WriteLine("Include=\"{0}\">", file);
462 468
463 int last_period_index = file.LastIndexOf('.'); 469 int last_period_index = file.LastIndexOf('.');
464 string short_file_name = (last_period_index >= 0) 470 string short_file_name = (last_period_index >= 0)
465 ? file.Substring(0, last_period_index) 471 ? file.Substring(0, last_period_index)
466 : file; 472 : file;
467 string extension = Path.GetExtension(path); 473 string extension = Path.GetExtension(path);
468 // make this upper case, so that when File.Exists tests for the 474 // make this upper case, so that when File.Exists tests for the
469 // existence of a designer file on a case-sensitive platform, 475 // existence of a designer file on a case-sensitive platform,
470 // it is correctly identified. 476 // it is correctly identified.
471 string designer_format = string.Format(".Designer{0}", extension); 477 string designer_format = string.Format(".Designer{0}", extension);
472 478
473 if (path_lower.EndsWith(designer_format.ToLowerInvariant())) 479 if (path_lower.EndsWith(designer_format.ToLowerInvariant()))
474 { 480 {
475 int designer_index = path.IndexOf(designer_format); 481 int designer_index = path.IndexOf(designer_format);
476 string file_name = path.Substring(0, designer_index); 482 string file_name = path.Substring(0, designer_index);
477 483
478 // There are two corrections to the next lines: 484 // There are two corrections to the next lines:
479 // 1. Fix the connection between a designer file and a form 485 // 1. Fix the connection between a designer file and a form
480 // or usercontrol that don't have an associated resx file. 486 // or usercontrol that don't have an associated resx file.
481 // 2. Connect settings files to associated designer files. 487 // 2. Connect settings files to associated designer files.
482 if (File.Exists(file_name + extension)) 488 if (File.Exists(file_name + extension))
483 ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", Path.GetFileName(file_name + extension)); 489 ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", Path.GetFileName(file_name + extension));
484 else if (File.Exists(file_name + ".resx")) 490 else if (File.Exists(file_name + ".resx"))
485 ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", Path.GetFileName(file_name + ".resx")); 491 ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", Path.GetFileName(file_name + ".resx"));
486 else if (File.Exists(file_name + ".settings")) 492 else if (File.Exists(file_name + ".settings"))
487 { 493 {
488 ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", Path.GetFileName(file_name + ".settings")); 494 ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", Path.GetFileName(file_name + ".settings"));
489 ps.WriteLine(" <AutoGen>True</AutoGen>"); 495 ps.WriteLine(" <AutoGen>True</AutoGen>");
490 ps.WriteLine(" <DesignTimeSharedInput>True</DesignTimeSharedInput>"); 496 ps.WriteLine(" <DesignTimeSharedInput>True</DesignTimeSharedInput>");
491 } 497 }
492 } 498 }
493 else if (subType == SubType.CodeBehind) 499 else if (subType == SubType.CodeBehind)
494 { 500 {
495 ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", Path.GetFileName(short_file_name)); 501 ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", Path.GetFileName(short_file_name));
496 } 502 }
497 if (project.Files.GetIsLink(filePath)) 503 if (project.Files.GetIsLink(filePath))
498 { 504 {
499 string alias = project.Files.GetLinkPath(filePath); 505 string alias = project.Files.GetLinkPath(filePath);
500 alias += file.Substring(startPos); 506 alias += file.Substring(startPos);
501 alias = Helper.NormalizePath(alias); 507 alias = Helper.NormalizePath(alias);
502 ps.WriteLine(" <Link>{0}</Link>", alias); 508 ps.WriteLine(" <Link>{0}</Link>", alias);
503 } 509 }
504 else if (project.Files.GetBuildAction(filePath) != BuildAction.None) 510 else if (project.Files.GetBuildAction(filePath) != BuildAction.None)
505 { 511 {
506 if (project.Files.GetBuildAction(filePath) != BuildAction.EmbeddedResource) 512 if (project.Files.GetBuildAction(filePath) != BuildAction.EmbeddedResource)
507 { 513 {
508 ps.WriteLine(" <SubType>{0}</SubType>", subType); 514 ps.WriteLine(" <SubType>{0}</SubType>", subType);
509 } 515 }
510 } 516 }
511 517
512 if (project.Files.GetCopyToOutput(filePath) != CopyToOutput.Never) 518 if (project.Files.GetCopyToOutput(filePath) != CopyToOutput.Never)
513 { 519 {
514 ps.WriteLine(" <CopyToOutputDirectory>{0}</CopyToOutputDirectory>", project.Files.GetCopyToOutput(filePath)); 520 ps.WriteLine(" <CopyToOutputDirectory>{0}</CopyToOutputDirectory>", project.Files.GetCopyToOutput(filePath));
515 } 521 }
516 522
517 ps.WriteLine(" </{0}>", project.Files.GetBuildAction(filePath)); 523 ps.WriteLine(" </{0}>", project.Files.GetBuildAction(filePath));
518 } 524 }
519 } 525 }
520 } 526 }
521 ps.WriteLine(" </ItemGroup>"); 527 ps.WriteLine(" </ItemGroup>");
522 528
523 /* 529 /*
@@ -553,420 +559,420 @@ namespace Prebuild.Core.Targets
553 ps.WriteLine(" </Target>"); 559 ps.WriteLine(" </Target>");
554 } 560 }
555 561
556 ps.WriteLine(" <Import Project=\"" + toolInfo.ImportProject + "\" />"); 562 ps.WriteLine(" <Import Project=\"" + toolInfo.ImportProject + "\" />");
557 ps.WriteLine(" <PropertyGroup>"); 563 ps.WriteLine(" <PropertyGroup>");
558 ps.WriteLine(" <PreBuildEvent>"); 564 ps.WriteLine(" <PreBuildEvent>");
559 ps.WriteLine(" </PreBuildEvent>"); 565 ps.WriteLine(" </PreBuildEvent>");
560 ps.WriteLine(" <PostBuildEvent>"); 566 ps.WriteLine(" <PostBuildEvent>");
561 ps.WriteLine(" </PostBuildEvent>"); 567 ps.WriteLine(" </PostBuildEvent>");
562 ps.WriteLine(" </PropertyGroup>"); 568 ps.WriteLine(" </PropertyGroup>");
563 ps.WriteLine("</Project>"); 569 ps.WriteLine("</Project>");
564 } 570 }
565 #endregion 571 #endregion
566 572
567 #region User File 573 #region User File
568 574
569 ps = new StreamWriter(projectFile + ".user"); 575 ps = new StreamWriter(projectFile + ".user");
570 using (ps) 576 using (ps)
571 { 577 {
572 // Get the first configuration from the project. 578 // Get the first configuration from the project.
573 ConfigurationNode firstConfiguration = null; 579 ConfigurationNode firstConfiguration = null;
574 580
575 if (project.Configurations.Count > 0) 581 if (project.Configurations.Count > 0)
576 { 582 {
577 firstConfiguration = project.Configurations[0]; 583 firstConfiguration = project.Configurations[0];
578 } 584 }
579 585
580 ps.WriteLine("<Project xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">"); 586 ps.WriteLine("<Project xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">");
581 //ps.WriteLine( "<VisualStudioProject>" ); 587 //ps.WriteLine( "<VisualStudioProject>" );
582 //ps.WriteLine(" <{0}>", toolInfo.XMLTag); 588 //ps.WriteLine(" <{0}>", toolInfo.XMLTag);
583 //ps.WriteLine(" <Build>"); 589 //ps.WriteLine(" <Build>");
584 ps.WriteLine(" <PropertyGroup>"); 590 ps.WriteLine(" <PropertyGroup>");
585 //ps.WriteLine(" <Settings ReferencePath=\"{0}\">", MakeRefPath(project)); 591 //ps.WriteLine(" <Settings ReferencePath=\"{0}\">", MakeRefPath(project));
586 592
587 if (firstConfiguration != null) 593 if (firstConfiguration != null)
588 { 594 {
589 ps.WriteLine(" <Configuration Condition=\" '$(Configuration)' == '' \">{0}</Configuration>", firstConfiguration.Name); 595 ps.WriteLine(" <Configuration Condition=\" '$(Configuration)' == '' \">{0}</Configuration>", firstConfiguration.Name);
590 ps.WriteLine(" <Platform Condition=\" '$(Platform)' == '' \">{0}</Platform>", firstConfiguration.Platform); 596 ps.WriteLine(" <Platform Condition=\" '$(Platform)' == '' \">{0}</Platform>", firstConfiguration.Platform);
591 } 597 }
592 598
593 ps.WriteLine(" <ReferencePath>{0}</ReferencePath>", MakeRefPath(project)); 599 ps.WriteLine(" <ReferencePath>{0}</ReferencePath>", MakeRefPath(project));
594 ps.WriteLine(" <LastOpenVersion>{0}</LastOpenVersion>", ProductVersion); 600 ps.WriteLine(" <LastOpenVersion>{0}</LastOpenVersion>", ProductVersion);
595 ps.WriteLine(" <ProjectView>ProjectFiles</ProjectView>"); 601 ps.WriteLine(" <ProjectView>ProjectFiles</ProjectView>");
596 ps.WriteLine(" <ProjectTrust>0</ProjectTrust>"); 602 ps.WriteLine(" <ProjectTrust>0</ProjectTrust>");
597 ps.WriteLine(" </PropertyGroup>"); 603 ps.WriteLine(" </PropertyGroup>");
598 foreach (ConfigurationNode conf in project.Configurations) 604 foreach (ConfigurationNode conf in project.Configurations)
599 { 605 {
600 ps.Write(" <PropertyGroup"); 606 ps.Write(" <PropertyGroup");
601 ps.Write(" Condition = \" '$(Configuration)|$(Platform)' == '{0}|{1}' \"", conf.Name, conf.Platform); 607 ps.Write(" Condition = \" '$(Configuration)|$(Platform)' == '{0}|{1}' \"", conf.Name, conf.Platform);
602 ps.WriteLine(" />"); 608 ps.WriteLine(" />");
603 } 609 }
604 ps.WriteLine("</Project>"); 610 ps.WriteLine("</Project>");
605 } 611 }
606 #endregion 612 #endregion
607 613
608 kernel.CurrentWorkingDirectory.Pop(); 614 kernel.CurrentWorkingDirectory.Pop();
609 } 615 }
610 616
611 private void WriteSolution(SolutionNode solution, bool writeSolutionToDisk) 617 private void WriteSolution(SolutionNode solution, bool writeSolutionToDisk)
612 { 618 {
613 kernel.Log.Write("Creating {0} solution and project files", VersionName); 619 kernel.Log.Write("Creating {0} solution and project files", VersionName);
614 620
615 foreach (SolutionNode child in solution.Solutions) 621 foreach (SolutionNode child in solution.Solutions)
616 { 622 {
617 kernel.Log.Write("...Creating folder: {0}", child.Name); 623 kernel.Log.Write("...Creating folder: {0}", child.Name);
618 WriteSolution(child, false); 624 WriteSolution(child, false);
619 } 625 }
620 626
621 foreach (ProjectNode project in solution.Projects) 627 foreach (ProjectNode project in solution.Projects)
622 { 628 {
623 kernel.Log.Write("...Creating project: {0}", project.Name); 629 kernel.Log.Write("...Creating project: {0}", project.Name);
624 WriteProject(solution, project); 630 WriteProject(solution, project);
625 } 631 }
626 632
627 foreach (DatabaseProjectNode project in solution.DatabaseProjects) 633 foreach (DatabaseProjectNode project in solution.DatabaseProjects)
628 { 634 {
629 kernel.Log.Write("...Creating database project: {0}", project.Name); 635 kernel.Log.Write("...Creating database project: {0}", project.Name);
630 WriteDatabaseProject(solution, project); 636 WriteDatabaseProject(solution, project);
631 } 637 }
632 638
633 if (writeSolutionToDisk) // only write main solution 639 if (writeSolutionToDisk) // only write main solution
634 { 640 {
635 kernel.Log.Write(""); 641 kernel.Log.Write("");
636 string solutionFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "sln"); 642 string solutionFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "sln");
637 643
638 using (StreamWriter ss = new StreamWriter(solutionFile)) 644 using (StreamWriter ss = new StreamWriter(solutionFile))
639 { 645 {
640 kernel.CurrentWorkingDirectory.Push(); 646 kernel.CurrentWorkingDirectory.Push();
641 Helper.SetCurrentDir(Path.GetDirectoryName(solutionFile)); 647 Helper.SetCurrentDir(Path.GetDirectoryName(solutionFile));
642 648
643 ss.WriteLine("Microsoft Visual Studio Solution File, Format Version {0}", SolutionVersion); 649 ss.WriteLine("Microsoft Visual Studio Solution File, Format Version {0}", SolutionVersion);
644 ss.WriteLine(SolutionTag); 650 ss.WriteLine(SolutionTag);
645 651
646 WriteProjectDeclarations(ss, solution, solution); 652 WriteProjectDeclarations(ss, solution, solution);
647 653
648 ss.WriteLine("Global"); 654 ss.WriteLine("Global");
649 655
650 ss.WriteLine("\tGlobalSection(SolutionConfigurationPlatforms) = preSolution"); 656 ss.WriteLine("\tGlobalSection(SolutionConfigurationPlatforms) = preSolution");
651 foreach (ConfigurationNode conf in solution.Configurations) 657 foreach (ConfigurationNode conf in solution.Configurations)
652 { 658 {
653 ss.WriteLine("\t\t{0} = {0}", conf.NameAndPlatform); 659 ss.WriteLine("\t\t{0} = {0}", conf.NameAndPlatform);
654 } 660 }
655 ss.WriteLine("\tEndGlobalSection"); 661 ss.WriteLine("\tEndGlobalSection");
656 662
657 ss.WriteLine("\tGlobalSection(ProjectConfigurationPlatforms) = postSolution"); 663 ss.WriteLine("\tGlobalSection(ProjectConfigurationPlatforms) = postSolution");
658 WriteConfigurationLines(solution.Configurations, solution, ss); 664 WriteConfigurationLines(solution.Configurations, solution, ss);
659 ss.WriteLine("\tEndGlobalSection"); 665 ss.WriteLine("\tEndGlobalSection");
660 666
661 if (solution.Solutions.Count > 0) 667 if (solution.Solutions.Count > 0)
662 { 668 {
663 ss.WriteLine("\tGlobalSection(NestedProjects) = preSolution"); 669 ss.WriteLine("\tGlobalSection(NestedProjects) = preSolution");
664 foreach (SolutionNode embeddedSolution in solution.Solutions) 670 foreach (SolutionNode embeddedSolution in solution.Solutions)
665 { 671 {
666 WriteNestedProjectMap(ss, embeddedSolution); 672 WriteNestedProjectMap(ss, embeddedSolution);
667 } 673 }
668 ss.WriteLine("\tEndGlobalSection"); 674 ss.WriteLine("\tEndGlobalSection");
669 } 675 }
670 676
671 ss.WriteLine("EndGlobal"); 677 ss.WriteLine("EndGlobal");
672 } 678 }
673 679
674 kernel.CurrentWorkingDirectory.Pop(); 680 kernel.CurrentWorkingDirectory.Pop();
675 } 681 }
676 } 682 }
677 683
678 private void WriteProjectDeclarations(TextWriter writer, SolutionNode actualSolution, SolutionNode embeddedSolution) 684 private void WriteProjectDeclarations(TextWriter writer, SolutionNode actualSolution, SolutionNode embeddedSolution)
679 { 685 {
680 foreach (SolutionNode childSolution in embeddedSolution.Solutions) 686 foreach (SolutionNode childSolution in embeddedSolution.Solutions)
681 { 687 {
682 WriteEmbeddedSolution(writer, childSolution); 688 WriteEmbeddedSolution(writer, childSolution);
683 WriteProjectDeclarations(writer, actualSolution, childSolution); 689 WriteProjectDeclarations(writer, actualSolution, childSolution);
684 } 690 }
685 691
686 foreach (ProjectNode project in embeddedSolution.Projects) 692 foreach (ProjectNode project in embeddedSolution.Projects)
687 { 693 {
688 WriteProject(actualSolution, writer, project); 694 WriteProject(actualSolution, writer, project);
689 } 695 }
690 696
691 foreach (DatabaseProjectNode dbProject in embeddedSolution.DatabaseProjects) 697 foreach (DatabaseProjectNode dbProject in embeddedSolution.DatabaseProjects)
692 { 698 {
693 WriteProject(actualSolution, writer, dbProject); 699 WriteProject(actualSolution, writer, dbProject);
694 } 700 }
695 701
696 if (actualSolution.Guid == embeddedSolution.Guid) 702 if (actualSolution.Guid == embeddedSolution.Guid)
697 { 703 {
698 WriteSolutionFiles(actualSolution, writer); 704 WriteSolutionFiles(actualSolution, writer);
699 } 705 }
700 } 706 }
701 707
702 private static void WriteNestedProjectMap(TextWriter writer, SolutionNode embeddedSolution) 708 private static void WriteNestedProjectMap(TextWriter writer, SolutionNode embeddedSolution)
703 { 709 {
704 foreach (ProjectNode project in embeddedSolution.Projects) 710 foreach (ProjectNode project in embeddedSolution.Projects)
705 { 711 {
706 WriteNestedProject(writer, embeddedSolution, project.Guid); 712 WriteNestedProject(writer, embeddedSolution, project.Guid);
707 } 713 }
708 714
709 foreach (DatabaseProjectNode dbProject in embeddedSolution.DatabaseProjects) 715 foreach (DatabaseProjectNode dbProject in embeddedSolution.DatabaseProjects)
710 { 716 {
711 WriteNestedProject(writer, embeddedSolution, dbProject.Guid); 717 WriteNestedProject(writer, embeddedSolution, dbProject.Guid);
712 } 718 }
713 719
714 foreach (SolutionNode child in embeddedSolution.Solutions) 720 foreach (SolutionNode child in embeddedSolution.Solutions)
715 { 721 {
716 WriteNestedProject(writer, embeddedSolution, child.Guid); 722 WriteNestedProject(writer, embeddedSolution, child.Guid);
717 WriteNestedProjectMap(writer, child); 723 WriteNestedProjectMap(writer, child);
718 } 724 }
719 } 725 }
720 726
721 private static void WriteNestedProject(TextWriter writer, SolutionNode solution, Guid projectGuid) 727 private static void WriteNestedProject(TextWriter writer, SolutionNode solution, Guid projectGuid)
722 { 728 {
723 WriteNestedFolder(writer, solution.Guid, projectGuid); 729 WriteNestedFolder(writer, solution.Guid, projectGuid);
724 } 730 }
725 731
726 private static void WriteNestedFolder(TextWriter writer, Guid parentGuid, Guid childGuid) 732 private static void WriteNestedFolder(TextWriter writer, Guid parentGuid, Guid childGuid)
727 { 733 {
728 writer.WriteLine("\t\t{0} = {1}", 734 writer.WriteLine("\t\t{0} = {1}",
729 childGuid.ToString("B").ToUpper(), 735 childGuid.ToString("B").ToUpper(),
730 parentGuid.ToString("B").ToUpper()); 736 parentGuid.ToString("B").ToUpper());
731 } 737 }
732 738
733 private static void WriteConfigurationLines(IEnumerable<ConfigurationNode> configurations, SolutionNode solution, TextWriter ss) 739 private static void WriteConfigurationLines(IEnumerable<ConfigurationNode> configurations, SolutionNode solution, TextWriter ss)
734 { 740 {
735 foreach (ProjectNode project in solution.Projects) 741 foreach (ProjectNode project in solution.Projects)
736 { 742 {
737 foreach (ConfigurationNode conf in configurations) 743 foreach (ConfigurationNode conf in configurations)
738 { 744 {
739 ss.WriteLine("\t\t{0}.{1}.ActiveCfg = {1}", 745 ss.WriteLine("\t\t{0}.{1}.ActiveCfg = {1}",
740 project.Guid.ToString("B").ToUpper(), 746 project.Guid.ToString("B").ToUpper(),
741 conf.NameAndPlatform); 747 conf.NameAndPlatform);
742 748
743 ss.WriteLine("\t\t{0}.{1}.Build.0 = {1}", 749 ss.WriteLine("\t\t{0}.{1}.Build.0 = {1}",
744 project.Guid.ToString("B").ToUpper(), 750 project.Guid.ToString("B").ToUpper(),
745 conf.NameAndPlatform); 751 conf.NameAndPlatform);
746 } 752 }
747 } 753 }
748 754
749 foreach (SolutionNode child in solution.Solutions) 755 foreach (SolutionNode child in solution.Solutions)
750 { 756 {
751 WriteConfigurationLines(configurations, child, ss); 757 WriteConfigurationLines(configurations, child, ss);
752 } 758 }
753 } 759 }
754 760
755 private void WriteSolutionFiles(SolutionNode solution, TextWriter ss) 761 private void WriteSolutionFiles(SolutionNode solution, TextWriter ss)
756 { 762 {
757 if(solution.Files != null && solution.Files.Count > 0) 763 if(solution.Files != null && solution.Files.Count > 0)
758 WriteProject(ss, "Folder", solution.Guid, "Solution Files", "Solution Files", solution.Files); 764 WriteProject(ss, "Folder", solution.Guid, "Solution Files", "Solution Files", solution.Files);
759 } 765 }
760 766
761 private void WriteEmbeddedSolution(TextWriter writer, SolutionNode embeddedSolution) 767 private void WriteEmbeddedSolution(TextWriter writer, SolutionNode embeddedSolution)
762 { 768 {
763 WriteProject(writer, "Folder", embeddedSolution.Guid, embeddedSolution.Name, embeddedSolution.Name, embeddedSolution.Files); 769 WriteProject(writer, "Folder", embeddedSolution.Guid, embeddedSolution.Name, embeddedSolution.Name, embeddedSolution.Files);
764 } 770 }
765 771
766 private void WriteProject(SolutionNode solution, TextWriter ss, ProjectNode project) 772 private void WriteProject(SolutionNode solution, TextWriter ss, ProjectNode project)
767 { 773 {
768 WriteProject(ss, solution, project.Language, project.Guid, project.Name, project.FullPath); 774 WriteProject(ss, solution, project.Language, project.Guid, project.Name, project.FullPath);
769 } 775 }
770 776
771 private void WriteProject(SolutionNode solution, TextWriter ss, DatabaseProjectNode dbProject) 777 private void WriteProject(SolutionNode solution, TextWriter ss, DatabaseProjectNode dbProject)
772 { 778 {
773 if (solution.Files != null && solution.Files.Count > 0) 779 if (solution.Files != null && solution.Files.Count > 0)
774 WriteProject(ss, solution, "Database", dbProject.Guid, dbProject.Name, dbProject.FullPath); 780 WriteProject(ss, solution, "Database", dbProject.Guid, dbProject.Name, dbProject.FullPath);
775 } 781 }
776 782
777 const string ProjectDeclarationBeginFormat = "Project(\"{0}\") = \"{1}\", \"{2}\", \"{3}\""; 783 const string ProjectDeclarationBeginFormat = "Project(\"{0}\") = \"{1}\", \"{2}\", \"{3}\"";
778 const string ProjectDeclarationEndFormat = "EndProject"; 784 const string ProjectDeclarationEndFormat = "EndProject";
779 785
780 private void WriteProject(TextWriter ss, SolutionNode solution, string language, Guid guid, string name, string projectFullPath) 786 private void WriteProject(TextWriter ss, SolutionNode solution, string language, Guid guid, string name, string projectFullPath)
781 { 787 {
782 if (!tools.ContainsKey(language)) 788 if (!tools.ContainsKey(language))
783 throw new UnknownLanguageException("Unknown .NET language: " + language); 789 throw new UnknownLanguageException("Unknown .NET language: " + language);
784 790
785 ToolInfo toolInfo = tools[language]; 791 ToolInfo toolInfo = tools[language];
786 792
787 string path = Helper.MakePathRelativeTo(solution.FullPath, projectFullPath); 793 string path = Helper.MakePathRelativeTo(solution.FullPath, projectFullPath);
788 794
789 path = Helper.MakeFilePath(path, name, toolInfo.FileExtension); 795 path = Helper.MakeFilePath(path, name, toolInfo.FileExtension);
790 796
791 WriteProject(ss, language, guid, name, path); 797 WriteProject(ss, language, guid, name, path);
792 } 798 }
793 799
794 private void WriteProject(TextWriter writer, string language, Guid projectGuid, string name, string location) 800 private void WriteProject(TextWriter writer, string language, Guid projectGuid, string name, string location)
795 { 801 {
796 WriteProject(writer, language, projectGuid, name, location, null); 802 WriteProject(writer, language, projectGuid, name, location, null);
797 } 803 }
798 804
799 private void WriteProject(TextWriter writer, string language, Guid projectGuid, string name, string location, FilesNode files) 805 private void WriteProject(TextWriter writer, string language, Guid projectGuid, string name, string location, FilesNode files)
800 { 806 {
801 if (!tools.ContainsKey(language)) 807 if (!tools.ContainsKey(language))
802 throw new UnknownLanguageException("Unknown .NET language: " + language); 808 throw new UnknownLanguageException("Unknown .NET language: " + language);
803 809
804 ToolInfo toolInfo = tools[language]; 810 ToolInfo toolInfo = tools[language];
805 811
806 writer.WriteLine(ProjectDeclarationBeginFormat, 812 writer.WriteLine(ProjectDeclarationBeginFormat,
807 toolInfo.Guid, 813 toolInfo.Guid,
808 name, 814 name,
809 location, 815 location,
810 projectGuid.ToString("B").ToUpper()); 816 projectGuid.ToString("B").ToUpper());
811 817
812 if (files != null) 818 if (files != null)
813 { 819 {
814 writer.WriteLine("\tProjectSection(SolutionItems) = preProject"); 820 writer.WriteLine("\tProjectSection(SolutionItems) = preProject");
815 821
816 foreach (string file in files) 822 foreach (string file in files)
817 writer.WriteLine("\t\t{0} = {0}", file); 823 writer.WriteLine("\t\t{0} = {0}", file);
818 824
819 writer.WriteLine("\tEndProjectSection"); 825 writer.WriteLine("\tEndProjectSection");
820 } 826 }
821 827
822 writer.WriteLine(ProjectDeclarationEndFormat); 828 writer.WriteLine(ProjectDeclarationEndFormat);
823 } 829 }
824 830
825 private void WriteDatabaseProject(SolutionNode solution, DatabaseProjectNode project) 831 private void WriteDatabaseProject(SolutionNode solution, DatabaseProjectNode project)
826 { 832 {
827 string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, "dbp"); 833 string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, "dbp");
828 IndentedTextWriter ps = new IndentedTextWriter(new StreamWriter(projectFile), " "); 834 IndentedTextWriter ps = new IndentedTextWriter(new StreamWriter(projectFile), " ");
829 835
830 kernel.CurrentWorkingDirectory.Push(); 836 kernel.CurrentWorkingDirectory.Push();
831 837
832 Helper.SetCurrentDir(Path.GetDirectoryName(projectFile)); 838 Helper.SetCurrentDir(Path.GetDirectoryName(projectFile));
833 839
834 using (ps) 840 using (ps)
835 { 841 {
836 ps.WriteLine("# Microsoft Developer Studio Project File - Database Project"); 842 ps.WriteLine("# Microsoft Developer Studio Project File - Database Project");
837 ps.WriteLine("Begin DataProject = \"{0}\"", project.Name); 843 ps.WriteLine("Begin DataProject = \"{0}\"", project.Name);
838 ps.Indent++; 844 ps.Indent++;
839 ps.WriteLine("MSDTVersion = \"80\""); 845 ps.WriteLine("MSDTVersion = \"80\"");
840 // TODO: Use the project.Files property 846 // TODO: Use the project.Files property
841 if (ContainsSqlFiles(Path.GetDirectoryName(projectFile))) 847 if (ContainsSqlFiles(Path.GetDirectoryName(projectFile)))
842 WriteDatabaseFoldersAndFiles(ps, Path.GetDirectoryName(projectFile)); 848 WriteDatabaseFoldersAndFiles(ps, Path.GetDirectoryName(projectFile));
843 849
844 ps.WriteLine("Begin DBRefFolder = \"Database References\""); 850 ps.WriteLine("Begin DBRefFolder = \"Database References\"");
845 ps.Indent++; 851 ps.Indent++;
846 foreach (DatabaseReferenceNode reference in project.References) 852 foreach (DatabaseReferenceNode reference in project.References)
847 { 853 {
848 ps.WriteLine("Begin DBRefNode = \"{0}\"", reference.Name); 854 ps.WriteLine("Begin DBRefNode = \"{0}\"", reference.Name);
849 ps.Indent++; 855 ps.Indent++;
850 ps.WriteLine("ConnectStr = \"{0}\"", reference.ConnectionString); 856 ps.WriteLine("ConnectStr = \"{0}\"", reference.ConnectionString);
851 ps.WriteLine("Provider = \"{0}\"", reference.ProviderId.ToString("B").ToUpper()); 857 ps.WriteLine("Provider = \"{0}\"", reference.ProviderId.ToString("B").ToUpper());
852 //ps.WriteLine("Colorizer = 5"); 858 //ps.WriteLine("Colorizer = 5");
853 ps.Indent--; 859 ps.Indent--;
854 ps.WriteLine("End"); 860 ps.WriteLine("End");
855 } 861 }
856 ps.Indent--; 862 ps.Indent--;
857 ps.WriteLine("End"); 863 ps.WriteLine("End");
858 ps.Indent--; 864 ps.Indent--;
859 ps.WriteLine("End"); 865 ps.WriteLine("End");
860 866
861 ps.Flush(); 867 ps.Flush();
862 } 868 }
863 869
864 kernel.CurrentWorkingDirectory.Pop(); 870 kernel.CurrentWorkingDirectory.Pop();
865 } 871 }
866 872
867 private static bool ContainsSqlFiles(string folder) 873 private static bool ContainsSqlFiles(string folder)
868 { 874 {
869 if(Directory.GetFiles(folder, "*.sql").Length > 0) 875 if(Directory.GetFiles(folder, "*.sql").Length > 0)
870 return true; // if the folder contains 1 .sql file, that's good enough 876 return true; // if the folder contains 1 .sql file, that's good enough
871 877
872 foreach (string child in Directory.GetDirectories(folder)) 878 foreach (string child in Directory.GetDirectories(folder))
873 { 879 {
874 if (ContainsSqlFiles(child)) 880 if (ContainsSqlFiles(child))
875 return true; // if 1 child folder contains a .sql file, still good enough 881 return true; // if 1 child folder contains a .sql file, still good enough
876 } 882 }
877 883
878 return false; 884 return false;
879 } 885 }
880 886
881 private static void WriteDatabaseFoldersAndFiles(IndentedTextWriter writer, string folder) 887 private static void WriteDatabaseFoldersAndFiles(IndentedTextWriter writer, string folder)
882 { 888 {
883 foreach (string child in Directory.GetDirectories(folder)) 889 foreach (string child in Directory.GetDirectories(folder))
884 { 890 {
885 if (ContainsSqlFiles(child)) 891 if (ContainsSqlFiles(child))
886 { 892 {
887 writer.WriteLine("Begin Folder = \"{0}\"", Path.GetFileName(child)); 893 writer.WriteLine("Begin Folder = \"{0}\"", Path.GetFileName(child));
888 writer.Indent++; 894 writer.Indent++;
889 WriteDatabaseFoldersAndFiles(writer, child); 895 WriteDatabaseFoldersAndFiles(writer, child);
890 writer.Indent--; 896 writer.Indent--;
891 writer.WriteLine("End"); 897 writer.WriteLine("End");
892 } 898 }
893 } 899 }
894 foreach (string file in Directory.GetFiles(folder, "*.sql")) 900 foreach (string file in Directory.GetFiles(folder, "*.sql"))
895 { 901 {
896 writer.WriteLine("Script = \"{0}\"", Path.GetFileName(file)); 902 writer.WriteLine("Script = \"{0}\"", Path.GetFileName(file));
897 } 903 }
898 } 904 }
899 905
900 private void CleanProject(ProjectNode project) 906 private void CleanProject(ProjectNode project)
901 { 907 {
902 kernel.Log.Write("...Cleaning project: {0}", project.Name); 908 kernel.Log.Write("...Cleaning project: {0}", project.Name);
903 909
904 ToolInfo toolInfo = tools[project.Language]; 910 ToolInfo toolInfo = tools[project.Language];
905 string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, toolInfo.FileExtension); 911 string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, toolInfo.FileExtension);
906 string userFile = projectFile + ".user"; 912 string userFile = projectFile + ".user";
907 913
908 Helper.DeleteIfExists(projectFile); 914 Helper.DeleteIfExists(projectFile);
909 Helper.DeleteIfExists(userFile); 915 Helper.DeleteIfExists(userFile);
910 } 916 }
911 917
912 private void CleanSolution(SolutionNode solution) 918 private void CleanSolution(SolutionNode solution)
913 { 919 {
914 kernel.Log.Write("Cleaning {0} solution and project files", VersionName, solution.Name); 920 kernel.Log.Write("Cleaning {0} solution and project files", VersionName, solution.Name);
915 921
916 string slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "sln"); 922 string slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "sln");
917 string suoFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "suo"); 923 string suoFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "suo");
918 924
919 Helper.DeleteIfExists(slnFile); 925 Helper.DeleteIfExists(slnFile);
920 Helper.DeleteIfExists(suoFile); 926 Helper.DeleteIfExists(suoFile);
921 927
922 foreach (ProjectNode project in solution.Projects) 928 foreach (ProjectNode project in solution.Projects)
923 { 929 {
924 CleanProject(project); 930 CleanProject(project);
925 } 931 }
926 932
927 kernel.Log.Write(""); 933 kernel.Log.Write("");
928 } 934 }
929 935
930 #endregion 936 #endregion
931 937
932 #region ITarget Members 938 #region ITarget Members
933 939
934 /// <summary> 940 /// <summary>
935 /// Writes the specified kern. 941 /// Writes the specified kern.
936 /// </summary> 942 /// </summary>
937 /// <param name="kern">The kern.</param> 943 /// <param name="kern">The kern.</param>
938 public virtual void Write(Kernel kern) 944 public virtual void Write(Kernel kern)
939 { 945 {
940 if (kern == null) 946 if (kern == null)
941 { 947 {
942 throw new ArgumentNullException("kern"); 948 throw new ArgumentNullException("kern");
943 } 949 }
944 kernel = kern; 950 kernel = kern;
945 foreach (SolutionNode sol in kernel.Solutions) 951 foreach (SolutionNode sol in kernel.Solutions)
946 { 952 {
947 WriteSolution(sol, true); 953 WriteSolution(sol, true);
948 } 954 }
949 kernel = null; 955 kernel = null;
950 } 956 }
951 957
952 /// <summary> 958 /// <summary>
953 /// Cleans the specified kern. 959 /// Cleans the specified kern.
954 /// </summary> 960 /// </summary>
955 /// <param name="kern">The kern.</param> 961 /// <param name="kern">The kern.</param>
956 public virtual void Clean(Kernel kern) 962 public virtual void Clean(Kernel kern)
957 { 963 {
958 if (kern == null) 964 if (kern == null)
959 { 965 {
960 throw new ArgumentNullException("kern"); 966 throw new ArgumentNullException("kern");
961 } 967 }
962 kernel = kern; 968 kernel = kern;
963 foreach (SolutionNode sol in kernel.Solutions) 969 foreach (SolutionNode sol in kernel.Solutions)
964 { 970 {
965 CleanSolution(sol); 971 CleanSolution(sol);
966 } 972 }
967 kernel = null; 973 kernel = null;
968 } 974 }
969 975
970 #endregion 976 #endregion
971 } 977 }
972} 978}
diff --git a/Prebuild/src/Core/Targets/VSVersion.cs b/Prebuild/src/Core/Targets/VSVersion.cs
index a7434c6..b917878 100644
--- a/Prebuild/src/Core/Targets/VSVersion.cs
+++ b/Prebuild/src/Core/Targets/VSVersion.cs
@@ -5,16 +5,16 @@ Copyright (c) 2008-2009 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehea
5Redistribution and use in source and binary forms, with or without modification, are permitted 5Redistribution and use in source and binary forms, with or without modification, are permitted
6provided that the following conditions are met: 6provided that the following conditions are met:
7 7
8* Redistributions of source code must retain the above copyright notice, this list of conditions 8* Redistributions of source code must retain the above copyright notice, this list of conditions
9 and the following disclaimer. 9 and the following disclaimer.
10* Redistributions in binary form must reproduce the above copyright notice, this list of conditions 10* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
11 and the following disclaimer in the documentation and/or other materials provided with the 11 and the following disclaimer in the documentation and/or other materials provided with the
12 distribution. 12 distribution.
13* The name of the author may not be used to endorse or promote products derived from this software 13* The name of the author may not be used to endorse or promote products derived from this software
14 without specific prior written permission. 14 without specific prior written permission.
15 15
16THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, 16THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
17BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 18ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 19EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 20OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
@@ -25,30 +25,43 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O
25 25
26namespace Prebuild.Core.Targets 26namespace Prebuild.Core.Targets
27{ 27{
28 /// <summary> 28 /// <summary>
29 /// 29 ///
30 /// </summary> 30 /// </summary>
31 public enum VSVersion 31 public enum VSVersion
32 { 32 {
33 /// <summary>
34 /// Visual Studio 2002
35 /// </summary>
36 VS70,
37 /// <summary>
38 /// Visual Studio 2003
39 /// </summary>
40 VS71,
41 /// <summary>
42 /// Visual Studio 2005
43 /// </summary>
44 VS80,
45 /// <summary>
46 /// Visual Studio 2008
47 /// </summary>
48 VS90,
49 /// <summary>
50 /// Visual Studio 2010
51 /// </summary>
52 VS10,
53 /// <summary>
54 /// Visual Studio 2012
55 /// </summary>
56 VS11,
57 /// <summary>
58 /// Visual Studio 2013
59 /// </summary>
60 VS12,
33 /// <summary> 61 /// <summary>
34 /// Visual Studio 2002 62 /// Visual Studio 2015
35 /// </summary> 63 /// </summary>
36 VS70, 64 VS15
37 /// <summary> 65
38 /// Visual Studio 2003 66 }
39 /// </summary>
40 VS71,
41 /// <summary>
42 /// Visual Studio 2005
43 /// </summary>
44 VS80,
45 /// <summary>
46 /// Visual Studio 2008
47 /// </summary>
48 VS90,
49 /// <summary>
50 /// Visual Studio 2010
51 /// </summary>
52 VS10
53 }
54} 67}
diff --git a/Prebuild/src/Core/Targets/XcodeTarget.cs b/Prebuild/src/Core/Targets/XcodeTarget.cs
index d2c86a0..5393cec 100644
--- a/Prebuild/src/Core/Targets/XcodeTarget.cs
+++ b/Prebuild/src/Core/Targets/XcodeTarget.cs
@@ -5,16 +5,16 @@ Copyright (c) 2004 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (da
5Redistribution and use in source and binary forms, with or without modification, are permitted 5Redistribution and use in source and binary forms, with or without modification, are permitted
6provided that the following conditions are met: 6provided that the following conditions are met:
7 7
8* Redistributions of source code must retain the above copyright notice, this list of conditions 8* Redistributions of source code must retain the above copyright notice, this list of conditions
9 and the following disclaimer. 9 and the following disclaimer.
10* Redistributions in binary form must reproduce the above copyright notice, this list of conditions 10* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
11 and the following disclaimer in the documentation and/or other materials provided with the 11 and the following disclaimer in the documentation and/or other materials provided with the
12 distribution. 12 distribution.
13* The name of the author may not be used to endorse or promote products derived from this software 13* The name of the author may not be used to endorse or promote products derived from this software
14 without specific prior written permission. 14 without specific prior written permission.
15 15
16THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, 16THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
17BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 18ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 19EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 20OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
@@ -36,7 +36,7 @@ using Prebuild.Core.Utilities;
36namespace Prebuild.Core.Targets 36namespace Prebuild.Core.Targets
37{ 37{
38 /// <summary> 38 /// <summary>
39 /// 39 ///
40 /// </summary> 40 /// </summary>
41 [Target("xcode")] 41 [Target("xcode")]
42 public class XcodeTarget : ITarget 42 public class XcodeTarget : ITarget
@@ -282,7 +282,7 @@ namespace Prebuild.Core.Targets
282 } 282 }
283 //if (project.Files.GetSubType(file).ToString() != "Code") 283 //if (project.Files.GetSubType(file).ToString() != "Code")
284 //{ 284 //{
285 // ps.WriteLine(" <EmbeddedResource Include=\"{0}\">", file.Substring(0, file.LastIndexOf('.')) + ".resx"); 285 // ps.WriteLine(" <EmbeddedResource Include=\"{0}\">", file.Substring(0, file.LastIndexOf('.')) + ".resx");
286 286
287 ss.WriteLine(" </resources>"); 287 ss.WriteLine(" </resources>");
288 ss.WriteLine(" <sources failonempty=\"true\">"); 288 ss.WriteLine(" <sources failonempty=\"true\">");