aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Prebuild/src/Core/Targets/VS2005Target.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Prebuild/src/Core/Targets/VS2005Target.cs')
-rw-r--r--Prebuild/src/Core/Targets/VS2005Target.cs1766
1 files changed, 883 insertions, 883 deletions
diff --git a/Prebuild/src/Core/Targets/VS2005Target.cs b/Prebuild/src/Core/Targets/VS2005Target.cs
index 23b6116..f01906b 100644
--- a/Prebuild/src/Core/Targets/VS2005Target.cs
+++ b/Prebuild/src/Core/Targets/VS2005Target.cs
@@ -1,883 +1,883 @@
1#region BSD License 1#region BSD License
2/* 2/*
3Copyright (c) 2004 Matthew Holmes (matthew@wildfiregames.com) 3Copyright (c) 2004 Matthew Holmes (matthew@wildfiregames.com)
4 4
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
21OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 21OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
22IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 22IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23*/ 23*/
24#endregion 24#endregion
25 25
26#region CVS Information 26#region CVS Information
27/* 27/*
28 * $Source$ 28 * $Source$
29 * $Author: robloach $ 29 * $Author: robloach $
30 * $Date: 2007-02-27 19:52:34 +0100 (ti, 27 feb 2007) $ 30 * $Date: 2007-02-27 19:52:34 +0100 (ti, 27 feb 2007) $
31 * $Revision: 207 $ 31 * $Revision: 207 $
32 */ 32 */
33#endregion 33#endregion
34 34
35using System; 35using System;
36using System.Collections; 36using System.Collections;
37using System.Collections.Specialized; 37using System.Collections.Specialized;
38using System.IO; 38using System.IO;
39 39
40using Prebuild.Core.Attributes; 40using Prebuild.Core.Attributes;
41using Prebuild.Core.Interfaces; 41using Prebuild.Core.Interfaces;
42using Prebuild.Core.Nodes; 42using Prebuild.Core.Nodes;
43using Prebuild.Core.Utilities; 43using Prebuild.Core.Utilities;
44 44
45namespace Prebuild.Core.Targets 45namespace Prebuild.Core.Targets
46{ 46{
47 /// <summary> 47 /// <summary>
48 /// 48 ///
49 /// </summary> 49 /// </summary>
50 public struct ToolInfo 50 public struct ToolInfo
51 { 51 {
52 string name; 52 string name;
53 string guid; 53 string guid;
54 string fileExtension; 54 string fileExtension;
55 string xmlTag; 55 string xmlTag;
56 string importProject; 56 string importProject;
57 57
58 /// <summary> 58 /// <summary>
59 /// Gets or sets the name. 59 /// Gets or sets the name.
60 /// </summary> 60 /// </summary>
61 /// <value>The name.</value> 61 /// <value>The name.</value>
62 public string Name 62 public string Name
63 { 63 {
64 get 64 get
65 { 65 {
66 return name; 66 return name;
67 } 67 }
68 set 68 set
69 { 69 {
70 name = value; 70 name = value;
71 } 71 }
72 } 72 }
73 73
74 /// <summary> 74 /// <summary>
75 /// Gets or sets the GUID. 75 /// Gets or sets the GUID.
76 /// </summary> 76 /// </summary>
77 /// <value>The GUID.</value> 77 /// <value>The GUID.</value>
78 public string Guid 78 public string Guid
79 { 79 {
80 get 80 get
81 { 81 {
82 return guid; 82 return guid;
83 } 83 }
84 set 84 set
85 { 85 {
86 guid = value; 86 guid = value;
87 } 87 }
88 } 88 }
89 89
90 /// <summary> 90 /// <summary>
91 /// Gets or sets the file extension. 91 /// Gets or sets the file extension.
92 /// </summary> 92 /// </summary>
93 /// <value>The file extension.</value> 93 /// <value>The file extension.</value>
94 public string FileExtension 94 public string FileExtension
95 { 95 {
96 get 96 get
97 { 97 {
98 return fileExtension; 98 return fileExtension;
99 } 99 }
100 set 100 set
101 { 101 {
102 fileExtension = value; 102 fileExtension = value;
103 } 103 }
104 } 104 }
105 /// <summary> 105 /// <summary>
106 /// Gets or sets the XML tag. 106 /// Gets or sets the XML tag.
107 /// </summary> 107 /// </summary>
108 /// <value>The XML tag.</value> 108 /// <value>The XML tag.</value>
109 public string XmlTag 109 public string XmlTag
110 { 110 {
111 get 111 get
112 { 112 {
113 return xmlTag; 113 return xmlTag;
114 } 114 }
115 set 115 set
116 { 116 {
117 xmlTag = value; 117 xmlTag = value;
118 } 118 }
119 } 119 }
120 120
121 /// <summary> 121 /// <summary>
122 /// Gets or sets the import project property. 122 /// Gets or sets the import project property.
123 /// </summary> 123 /// </summary>
124 /// <value>The ImportProject tag.</value> 124 /// <value>The ImportProject tag.</value>
125 public string ImportProject 125 public string ImportProject
126 { 126 {
127 get 127 get
128 { 128 {
129 return importProject; 129 return importProject;
130 } 130 }
131 set 131 set
132 { 132 {
133 importProject = value; 133 importProject = value;
134 } 134 }
135 } 135 }
136 136
137 /// <summary> 137 /// <summary>
138 /// Initializes a new instance of the <see cref="ToolInfo"/> class. 138 /// Initializes a new instance of the <see cref="ToolInfo"/> class.
139 /// </summary> 139 /// </summary>
140 /// <param name="name">The name.</param> 140 /// <param name="name">The name.</param>
141 /// <param name="guid">The GUID.</param> 141 /// <param name="guid">The GUID.</param>
142 /// <param name="fileExtension">The file extension.</param> 142 /// <param name="fileExtension">The file extension.</param>
143 /// <param name="xml">The XML.</param> 143 /// <param name="xml">The XML.</param>
144 /// <param name="importProject">The import project.</param> 144 /// <param name="importProject">The import project.</param>
145 public ToolInfo(string name, string guid, string fileExtension, string xml, string importProject) 145 public ToolInfo(string name, string guid, string fileExtension, string xml, string importProject)
146 { 146 {
147 this.name = name; 147 this.name = name;
148 this.guid = guid; 148 this.guid = guid;
149 this.fileExtension = fileExtension; 149 this.fileExtension = fileExtension;
150 this.xmlTag = xml; 150 this.xmlTag = xml;
151 this.importProject = importProject; 151 this.importProject = importProject;
152 } 152 }
153 153
154 /// <summary> 154 /// <summary>
155 /// Initializes a new instance of the <see cref="ToolInfo"/> class. 155 /// Initializes a new instance of the <see cref="ToolInfo"/> class.
156 /// </summary> 156 /// </summary>
157 /// <param name="name">The name.</param> 157 /// <param name="name">The name.</param>
158 /// <param name="guid">The GUID.</param> 158 /// <param name="guid">The GUID.</param>
159 /// <param name="fileExtension">The file extension.</param> 159 /// <param name="fileExtension">The file extension.</param>
160 /// <param name="xml">The XML.</param> 160 /// <param name="xml">The XML.</param>
161 public ToolInfo(string name, string guid, string fileExtension, string xml) 161 public ToolInfo(string name, string guid, string fileExtension, string xml)
162 { 162 {
163 this.name = name; 163 this.name = name;
164 this.guid = guid; 164 this.guid = guid;
165 this.fileExtension = fileExtension; 165 this.fileExtension = fileExtension;
166 this.xmlTag = xml; 166 this.xmlTag = xml;
167 this.importProject = "$(MSBuildBinPath)\\Microsoft." + xml + ".Targets"; 167 this.importProject = "$(MSBuildBinPath)\\Microsoft." + xml + ".Targets";
168 } 168 }
169 169
170 /// <summary> 170 /// <summary>
171 /// Equals operator 171 /// Equals operator
172 /// </summary> 172 /// </summary>
173 /// <param name="obj">ToolInfo to compare</param> 173 /// <param name="obj">ToolInfo to compare</param>
174 /// <returns>true if toolInfos are equal</returns> 174 /// <returns>true if toolInfos are equal</returns>
175 public override bool Equals(object obj) 175 public override bool Equals(object obj)
176 { 176 {
177 if (obj == null) 177 if (obj == null)
178 { 178 {
179 throw new ArgumentNullException("obj"); 179 throw new ArgumentNullException("obj");
180 } 180 }
181 if (obj.GetType() != typeof(ToolInfo)) 181 if (obj.GetType() != typeof(ToolInfo))
182 return false; 182 return false;
183 183
184 ToolInfo c = (ToolInfo)obj; 184 ToolInfo c = (ToolInfo)obj;
185 return ((this.name == c.name) && (this.guid == c.guid) && (this.fileExtension == c.fileExtension) && (this.importProject == c.importProject)); 185 return ((this.name == c.name) && (this.guid == c.guid) && (this.fileExtension == c.fileExtension) && (this.importProject == c.importProject));
186 } 186 }
187 187
188 /// <summary> 188 /// <summary>
189 /// Equals operator 189 /// Equals operator
190 /// </summary> 190 /// </summary>
191 /// <param name="c1">ToolInfo to compare</param> 191 /// <param name="c1">ToolInfo to compare</param>
192 /// <param name="c2">ToolInfo to compare</param> 192 /// <param name="c2">ToolInfo to compare</param>
193 /// <returns>True if toolInfos are equal</returns> 193 /// <returns>True if toolInfos are equal</returns>
194 public static bool operator ==(ToolInfo c1, ToolInfo c2) 194 public static bool operator ==(ToolInfo c1, ToolInfo c2)
195 { 195 {
196 return ((c1.name == c2.name) && (c1.guid == c2.guid) && (c1.fileExtension == c2.fileExtension) && (c1.importProject == c2.importProject) && (c1.xmlTag == c2.xmlTag)); 196 return ((c1.name == c2.name) && (c1.guid == c2.guid) && (c1.fileExtension == c2.fileExtension) && (c1.importProject == c2.importProject) && (c1.xmlTag == c2.xmlTag));
197 } 197 }
198 198
199 /// <summary> 199 /// <summary>
200 /// Not equals operator 200 /// Not equals operator
201 /// </summary> 201 /// </summary>
202 /// <param name="c1">ToolInfo to compare</param> 202 /// <param name="c1">ToolInfo to compare</param>
203 /// <param name="c2">ToolInfo to compare</param> 203 /// <param name="c2">ToolInfo to compare</param>
204 /// <returns>True if toolInfos are not equal</returns> 204 /// <returns>True if toolInfos are not equal</returns>
205 public static bool operator !=(ToolInfo c1, ToolInfo c2) 205 public static bool operator !=(ToolInfo c1, ToolInfo c2)
206 { 206 {
207 return !(c1 == c2); 207 return !(c1 == c2);
208 } 208 }
209 209
210 /// <summary> 210 /// <summary>
211 /// Hash Code 211 /// Hash Code
212 /// </summary> 212 /// </summary>
213 /// <returns>Hash code</returns> 213 /// <returns>Hash code</returns>
214 public override int GetHashCode() 214 public override int GetHashCode()
215 { 215 {
216 return name.GetHashCode() ^ guid.GetHashCode() ^ this.fileExtension.GetHashCode() ^ this.importProject.GetHashCode() ^ this.xmlTag.GetHashCode(); 216 return name.GetHashCode() ^ guid.GetHashCode() ^ this.fileExtension.GetHashCode() ^ this.importProject.GetHashCode() ^ this.xmlTag.GetHashCode();
217 217
218 } 218 }
219 } 219 }
220 220
221 /// <summary> 221 /// <summary>
222 /// 222 ///
223 /// </summary> 223 /// </summary>
224 [Target("vs2005")] 224 [Target("vs2005")]
225 public class VS2005Target : ITarget 225 public class VS2005Target : ITarget
226 { 226 {
227 #region Inner Classes 227 #region Inner Classes
228 228
229 #endregion 229 #endregion
230 230
231 #region Fields 231 #region Fields
232 232
233 string solutionVersion = "9.00"; 233 string solutionVersion = "9.00";
234 string productVersion = "8.0.50727"; 234 string productVersion = "8.0.50727";
235 string schemaVersion = "2.0"; 235 string schemaVersion = "2.0";
236 string versionName = "Visual C# 2005"; 236 string versionName = "Visual C# 2005";
237 VSVersion version = VSVersion.VS80; 237 VSVersion version = VSVersion.VS80;
238 238
239 Hashtable tools; 239 Hashtable tools;
240 Kernel kernel; 240 Kernel kernel;
241 241
242 /// <summary> 242 /// <summary>
243 /// Gets or sets the solution version. 243 /// Gets or sets the solution version.
244 /// </summary> 244 /// </summary>
245 /// <value>The solution version.</value> 245 /// <value>The solution version.</value>
246 protected string SolutionVersion 246 protected string SolutionVersion
247 { 247 {
248 get 248 get
249 { 249 {
250 return this.solutionVersion; 250 return this.solutionVersion;
251 } 251 }
252 set 252 set
253 { 253 {
254 this.solutionVersion = value; 254 this.solutionVersion = value;
255 } 255 }
256 } 256 }
257 /// <summary> 257 /// <summary>
258 /// Gets or sets the product version. 258 /// Gets or sets the product version.
259 /// </summary> 259 /// </summary>
260 /// <value>The product version.</value> 260 /// <value>The product version.</value>
261 protected string ProductVersion 261 protected string ProductVersion
262 { 262 {
263 get 263 get
264 { 264 {
265 return this.productVersion; 265 return this.productVersion;
266 } 266 }
267 set 267 set
268 { 268 {
269 this.productVersion = value; 269 this.productVersion = value;
270 } 270 }
271 } 271 }
272 /// <summary> 272 /// <summary>
273 /// Gets or sets the schema version. 273 /// Gets or sets the schema version.
274 /// </summary> 274 /// </summary>
275 /// <value>The schema version.</value> 275 /// <value>The schema version.</value>
276 protected string SchemaVersion 276 protected string SchemaVersion
277 { 277 {
278 get 278 get
279 { 279 {
280 return this.schemaVersion; 280 return this.schemaVersion;
281 } 281 }
282 set 282 set
283 { 283 {
284 this.schemaVersion = value; 284 this.schemaVersion = value;
285 } 285 }
286 } 286 }
287 /// <summary> 287 /// <summary>
288 /// Gets or sets the name of the version. 288 /// Gets or sets the name of the version.
289 /// </summary> 289 /// </summary>
290 /// <value>The name of the version.</value> 290 /// <value>The name of the version.</value>
291 protected string VersionName 291 protected string VersionName
292 { 292 {
293 get 293 get
294 { 294 {
295 return this.versionName; 295 return this.versionName;
296 } 296 }
297 set 297 set
298 { 298 {
299 this.versionName = value; 299 this.versionName = value;
300 } 300 }
301 } 301 }
302 /// <summary> 302 /// <summary>
303 /// Gets or sets the version. 303 /// Gets or sets the version.
304 /// </summary> 304 /// </summary>
305 /// <value>The version.</value> 305 /// <value>The version.</value>
306 protected VSVersion Version 306 protected VSVersion Version
307 { 307 {
308 get 308 get
309 { 309 {
310 return this.version; 310 return this.version;
311 } 311 }
312 set 312 set
313 { 313 {
314 this.version = value; 314 this.version = value;
315 } 315 }
316 } 316 }
317 317
318 #endregion 318 #endregion
319 319
320 #region Constructors 320 #region Constructors
321 321
322 /// <summary> 322 /// <summary>
323 /// Initializes a new instance of the <see cref="VS2005Target"/> class. 323 /// Initializes a new instance of the <see cref="VS2005Target"/> class.
324 /// </summary> 324 /// </summary>
325 public VS2005Target() 325 public VS2005Target()
326 { 326 {
327 this.tools = new Hashtable(); 327 this.tools = new Hashtable();
328 328
329 this.tools["C#"] = new ToolInfo("C#", "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}", "csproj", "CSHARP", "$(MSBuildBinPath)\\Microsoft.CSHARP.Targets"); 329 this.tools["C#"] = new ToolInfo("C#", "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}", "csproj", "CSHARP", "$(MSBuildBinPath)\\Microsoft.CSHARP.Targets");
330 this.tools["Boo"] = new ToolInfo("Boo", "{45CEA7DC-C2ED-48A6-ACE0-E16144C02365}", "booproj", "Boo", "$(BooBinPath)\\Boo.Microsoft.Build.targets"); 330 this.tools["Boo"] = new ToolInfo("Boo", "{45CEA7DC-C2ED-48A6-ACE0-E16144C02365}", "booproj", "Boo", "$(BooBinPath)\\Boo.Microsoft.Build.targets");
331 this.tools["VisualBasic"] = new ToolInfo("VisualBasic", "{F184B08F-C81C-45F6-A57F-5ABD9991F28F}", "vbproj", "VisualBasic", "$(MSBuildBinPath)\\Microsoft.VisualBasic.Targets"); 331 this.tools["VisualBasic"] = new ToolInfo("VisualBasic", "{F184B08F-C81C-45F6-A57F-5ABD9991F28F}", "vbproj", "VisualBasic", "$(MSBuildBinPath)\\Microsoft.VisualBasic.Targets");
332 } 332 }
333 333
334 #endregion 334 #endregion
335 335
336 #region Private Methods 336 #region Private Methods
337 337
338 private string MakeRefPath(ProjectNode project) 338 private string MakeRefPath(ProjectNode project)
339 { 339 {
340 string ret = ""; 340 string ret = "";
341 foreach (ReferencePathNode node in project.ReferencePaths) 341 foreach (ReferencePathNode node in project.ReferencePaths)
342 { 342 {
343 try 343 try
344 { 344 {
345 string fullPath = Helper.ResolvePath(node.Path); 345 string fullPath = Helper.ResolvePath(node.Path);
346 if (ret.Length < 1) 346 if (ret.Length < 1)
347 { 347 {
348 ret = fullPath; 348 ret = fullPath;
349 } 349 }
350 else 350 else
351 { 351 {
352 ret += ";" + fullPath; 352 ret += ";" + fullPath;
353 } 353 }
354 } 354 }
355 catch (ArgumentException) 355 catch (ArgumentException)
356 { 356 {
357 this.kernel.Log.Write(LogType.Warning, "Could not resolve reference path: {0}", node.Path); 357 this.kernel.Log.Write(LogType.Warning, "Could not resolve reference path: {0}", node.Path);
358 } 358 }
359 } 359 }
360 360
361 return ret; 361 return ret;
362 } 362 }
363 363
364 private void WriteProject(SolutionNode solution, ProjectNode project) 364 private void WriteProject(SolutionNode solution, ProjectNode project)
365 { 365 {
366 if (!tools.ContainsKey(project.Language)) 366 if (!tools.ContainsKey(project.Language))
367 { 367 {
368 throw new UnknownLanguageException("Unknown .NET language: " + project.Language); 368 throw new UnknownLanguageException("Unknown .NET language: " + project.Language);
369 } 369 }
370 370
371 ToolInfo toolInfo = (ToolInfo)tools[project.Language]; 371 ToolInfo toolInfo = (ToolInfo)tools[project.Language];
372 string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, toolInfo.FileExtension); 372 string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, toolInfo.FileExtension);
373 StreamWriter ps = new StreamWriter(projectFile); 373 StreamWriter ps = new StreamWriter(projectFile);
374 374
375 kernel.CurrentWorkingDirectory.Push(); 375 kernel.CurrentWorkingDirectory.Push();
376 Helper.SetCurrentDir(Path.GetDirectoryName(projectFile)); 376 Helper.SetCurrentDir(Path.GetDirectoryName(projectFile));
377 377
378 #region Project File 378 #region Project File
379 using (ps) 379 using (ps)
380 { 380 {
381 ps.WriteLine("<Project DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">"); 381 ps.WriteLine("<Project DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">");
382 //ps.WriteLine(" <{0}", toolInfo.XMLTag); 382 //ps.WriteLine(" <{0}", toolInfo.XMLTag);
383 ps.WriteLine(" <PropertyGroup>"); 383 ps.WriteLine(" <PropertyGroup>");
384 ps.WriteLine(" <ProjectType>Local</ProjectType>"); 384 ps.WriteLine(" <ProjectType>Local</ProjectType>");
385 ps.WriteLine(" <ProductVersion>{0}</ProductVersion>", this.ProductVersion); 385 ps.WriteLine(" <ProductVersion>{0}</ProductVersion>", this.ProductVersion);
386 ps.WriteLine(" <SchemaVersion>{0}</SchemaVersion>", this.SchemaVersion); 386 ps.WriteLine(" <SchemaVersion>{0}</SchemaVersion>", this.SchemaVersion);
387 ps.WriteLine(" <ProjectGuid>{{{0}}}</ProjectGuid>", project.Guid.ToString().ToUpper()); 387 ps.WriteLine(" <ProjectGuid>{{{0}}}</ProjectGuid>", project.Guid.ToString().ToUpper());
388 388
389 ps.WriteLine(" <Configuration Condition=\" '$(Configuration)' == '' \">Debug</Configuration>"); 389 ps.WriteLine(" <Configuration Condition=\" '$(Configuration)' == '' \">Debug</Configuration>");
390 ps.WriteLine(" <Platform Condition=\" '$(Platform)' == '' \">AnyCPU</Platform>"); 390 ps.WriteLine(" <Platform Condition=\" '$(Platform)' == '' \">AnyCPU</Platform>");
391 //ps.WriteLine(" <Build>"); 391 //ps.WriteLine(" <Build>");
392 392
393 //ps.WriteLine(" <Settings"); 393 //ps.WriteLine(" <Settings");
394 ps.WriteLine(" <ApplicationIcon>{0}</ApplicationIcon>", project.AppIcon); 394 ps.WriteLine(" <ApplicationIcon>{0}</ApplicationIcon>", project.AppIcon);
395 ps.WriteLine(" <AssemblyKeyContainerName>"); 395 ps.WriteLine(" <AssemblyKeyContainerName>");
396 ps.WriteLine(" </AssemblyKeyContainerName>"); 396 ps.WriteLine(" </AssemblyKeyContainerName>");
397 ps.WriteLine(" <AssemblyName>{0}</AssemblyName>", project.AssemblyName); 397 ps.WriteLine(" <AssemblyName>{0}</AssemblyName>", project.AssemblyName);
398 foreach (ConfigurationNode conf in project.Configurations) 398 foreach (ConfigurationNode conf in project.Configurations)
399 { 399 {
400 if (conf.Options.KeyFile != "") 400 if (conf.Options.KeyFile != "")
401 { 401 {
402 ps.WriteLine(" <AssemblyOriginatorKeyFile>{0}</AssemblyOriginatorKeyFile>", conf.Options.KeyFile); 402 ps.WriteLine(" <AssemblyOriginatorKeyFile>{0}</AssemblyOriginatorKeyFile>", conf.Options.KeyFile);
403 ps.WriteLine(" <SignAssembly>true</SignAssembly>"); 403 ps.WriteLine(" <SignAssembly>true</SignAssembly>");
404 break; 404 break;
405 } 405 }
406 } 406 }
407 ps.WriteLine(" <DefaultClientScript>JScript</DefaultClientScript>"); 407 ps.WriteLine(" <DefaultClientScript>JScript</DefaultClientScript>");
408 ps.WriteLine(" <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>"); 408 ps.WriteLine(" <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>");
409 ps.WriteLine(" <DefaultTargetSchema>IE50</DefaultTargetSchema>"); 409 ps.WriteLine(" <DefaultTargetSchema>IE50</DefaultTargetSchema>");
410 ps.WriteLine(" <DelaySign>false</DelaySign>"); 410 ps.WriteLine(" <DelaySign>false</DelaySign>");
411 411
412 //if(m_Version == VSVersion.VS70) 412 //if(m_Version == VSVersion.VS70)
413 // ps.WriteLine(" NoStandardLibraries = \"false\""); 413 // ps.WriteLine(" NoStandardLibraries = \"false\"");
414 414
415 ps.WriteLine(" <OutputType>{0}</OutputType>", project.Type.ToString()); 415 ps.WriteLine(" <OutputType>{0}</OutputType>", project.Type.ToString());
416 ps.WriteLine(" <AppDesignerFolder>{0}</AppDesignerFolder>", project.DesignerFolder); 416 ps.WriteLine(" <AppDesignerFolder>{0}</AppDesignerFolder>", project.DesignerFolder);
417 ps.WriteLine(" <RootNamespace>{0}</RootNamespace>", project.RootNamespace); 417 ps.WriteLine(" <RootNamespace>{0}</RootNamespace>", project.RootNamespace);
418 ps.WriteLine(" <StartupObject>{0}</StartupObject>", project.StartupObject); 418 ps.WriteLine(" <StartupObject>{0}</StartupObject>", project.StartupObject);
419 //ps.WriteLine(" >"); 419 //ps.WriteLine(" >");
420 ps.WriteLine(" <FileUpgradeFlags>"); 420 ps.WriteLine(" <FileUpgradeFlags>");
421 ps.WriteLine(" </FileUpgradeFlags>"); 421 ps.WriteLine(" </FileUpgradeFlags>");
422 422
423 ps.WriteLine(" </PropertyGroup>"); 423 ps.WriteLine(" </PropertyGroup>");
424 424
425 foreach (ConfigurationNode conf in project.Configurations) 425 foreach (ConfigurationNode conf in project.Configurations)
426 { 426 {
427 ps.Write(" <PropertyGroup "); 427 ps.Write(" <PropertyGroup ");
428 ps.WriteLine("Condition=\" '$(Configuration)|$(Platform)' == '{0}|AnyCPU' \">", conf.Name); 428 ps.WriteLine("Condition=\" '$(Configuration)|$(Platform)' == '{0}|AnyCPU' \">", conf.Name);
429 ps.WriteLine(" <AllowUnsafeBlocks>{0}</AllowUnsafeBlocks>", conf.Options["AllowUnsafe"]); 429 ps.WriteLine(" <AllowUnsafeBlocks>{0}</AllowUnsafeBlocks>", conf.Options["AllowUnsafe"]);
430 ps.WriteLine(" <BaseAddress>{0}</BaseAddress>", conf.Options["BaseAddress"]); 430 ps.WriteLine(" <BaseAddress>{0}</BaseAddress>", conf.Options["BaseAddress"]);
431 ps.WriteLine(" <CheckForOverflowUnderflow>{0}</CheckForOverflowUnderflow>", conf.Options["CheckUnderflowOverflow"]); 431 ps.WriteLine(" <CheckForOverflowUnderflow>{0}</CheckForOverflowUnderflow>", conf.Options["CheckUnderflowOverflow"]);
432 ps.WriteLine(" <ConfigurationOverrideFile>"); 432 ps.WriteLine(" <ConfigurationOverrideFile>");
433 ps.WriteLine(" </ConfigurationOverrideFile>"); 433 ps.WriteLine(" </ConfigurationOverrideFile>");
434 ps.WriteLine(" <DefineConstants>{0}</DefineConstants>", conf.Options["CompilerDefines"]); 434 ps.WriteLine(" <DefineConstants>{0}</DefineConstants>", conf.Options["CompilerDefines"]);
435 ps.WriteLine(" <DocumentationFile>{0}</DocumentationFile>", conf.Options["XmlDocFile"]); 435 ps.WriteLine(" <DocumentationFile>{0}</DocumentationFile>", conf.Options["XmlDocFile"]);
436 ps.WriteLine(" <DebugSymbols>{0}</DebugSymbols>", conf.Options["DebugInformation"]); 436 ps.WriteLine(" <DebugSymbols>{0}</DebugSymbols>", conf.Options["DebugInformation"]);
437 ps.WriteLine(" <FileAlignment>{0}</FileAlignment>", conf.Options["FileAlignment"]); 437 ps.WriteLine(" <FileAlignment>{0}</FileAlignment>", conf.Options["FileAlignment"]);
438 // ps.WriteLine(" <IncrementalBuild = \"{0}\"", conf.Options["IncrementalBuild"]); 438 // ps.WriteLine(" <IncrementalBuild = \"{0}\"", conf.Options["IncrementalBuild"]);
439 439
440 // if(m_Version == VSVersion.VS71) 440 // if(m_Version == VSVersion.VS71)
441 // { 441 // {
442 // ps.WriteLine(" NoStdLib = \"{0}\"", conf.Options["NoStdLib"]); 442 // ps.WriteLine(" NoStdLib = \"{0}\"", conf.Options["NoStdLib"]);
443 // ps.WriteLine(" NoWarn = \"{0}\"", conf.Options["SuppressWarnings"]); 443 // ps.WriteLine(" NoWarn = \"{0}\"", conf.Options["SuppressWarnings"]);
444 // } 444 // }
445 445
446 ps.WriteLine(" <Optimize>{0}</Optimize>", conf.Options["OptimizeCode"]); 446 ps.WriteLine(" <Optimize>{0}</Optimize>", conf.Options["OptimizeCode"]);
447 ps.WriteLine(" <OutputPath>{0}</OutputPath>", 447 ps.WriteLine(" <OutputPath>{0}</OutputPath>",
448 Helper.EndPath(Helper.NormalizePath(conf.Options["OutputPath"].ToString()))); 448 Helper.EndPath(Helper.NormalizePath(conf.Options["OutputPath"].ToString())));
449 ps.WriteLine(" <RegisterForComInterop>{0}</RegisterForComInterop>", conf.Options["RegisterComInterop"]); 449 ps.WriteLine(" <RegisterForComInterop>{0}</RegisterForComInterop>", conf.Options["RegisterComInterop"]);
450 ps.WriteLine(" <RemoveIntegerChecks>{0}</RemoveIntegerChecks>", conf.Options["RemoveIntegerChecks"]); 450 ps.WriteLine(" <RemoveIntegerChecks>{0}</RemoveIntegerChecks>", conf.Options["RemoveIntegerChecks"]);
451 ps.WriteLine(" <TreatWarningsAsErrors>{0}</TreatWarningsAsErrors>", conf.Options["WarningsAsErrors"]); 451 ps.WriteLine(" <TreatWarningsAsErrors>{0}</TreatWarningsAsErrors>", conf.Options["WarningsAsErrors"]);
452 ps.WriteLine(" <WarningLevel>{0}</WarningLevel>", conf.Options["WarningLevel"]); 452 ps.WriteLine(" <WarningLevel>{0}</WarningLevel>", conf.Options["WarningLevel"]);
453 ps.WriteLine(" <NoWarn>{0}</NoWarn>", conf.Options["SuppressWarnings"]); 453 ps.WriteLine(" <NoWarn>{0}</NoWarn>", conf.Options["SuppressWarnings"]);
454 ps.WriteLine(" </PropertyGroup>"); 454 ps.WriteLine(" </PropertyGroup>");
455 } 455 }
456 456
457 //ps.WriteLine(" </Settings>"); 457 //ps.WriteLine(" </Settings>");
458 458
459 // Assembly References 459 // Assembly References
460 ps.WriteLine(" <ItemGroup>"); 460 ps.WriteLine(" <ItemGroup>");
461 string refPath = ((ReferencePathNode) project.ReferencePaths[0]).Path; 461 string refPath = ((ReferencePathNode) project.ReferencePaths[0]).Path;
462 462
463 foreach (ReferenceNode refr in project.References) 463 foreach (ReferenceNode refr in project.References)
464 { 464 {
465 if (!solution.ProjectsTable.ContainsKey(refr.Name)) 465 if (!solution.ProjectsTable.ContainsKey(refr.Name))
466 { 466 {
467 ps.Write(" <Reference"); 467 ps.Write(" <Reference");
468 ps.Write(" Include=\""); 468 ps.Write(" Include=\"");
469 ps.Write(refr.Name); 469 ps.Write(refr.Name);
470 470
471 ps.WriteLine("\" >"); 471 ps.WriteLine("\" >");
472 472
473 string path; 473 string path;
474 474
475 if( refr.Name.EndsWith(".dll", StringComparison.InvariantCultureIgnoreCase )) 475 if( refr.Name.EndsWith(".dll", StringComparison.InvariantCultureIgnoreCase ))
476 { 476 {
477 path = Helper.NormalizePath(Path.Combine( refPath, refr.Name), '\\'); 477 path = Helper.NormalizePath(Path.Combine( refPath, refr.Name), '\\');
478 } 478 }
479 else 479 else
480 { 480 {
481 path = refr.Name + ".dll"; 481 path = refr.Name + ".dll";
482 } 482 }
483 483
484 // TODO: Allow reference to *.exe files 484 // TODO: Allow reference to *.exe files
485 ps.WriteLine(" <HintPath>{0}</HintPath>", path ); 485 ps.WriteLine(" <HintPath>{0}</HintPath>", path );
486 ps.WriteLine(" <Private>{0}</Private>", refr.LocalCopy); 486 ps.WriteLine(" <Private>{0}</Private>", refr.LocalCopy);
487 ps.WriteLine(" </Reference>"); 487 ps.WriteLine(" </Reference>");
488 } 488 }
489 } 489 }
490 ps.WriteLine(" </ItemGroup>"); 490 ps.WriteLine(" </ItemGroup>");
491 491
492 //Project References 492 //Project References
493 ps.WriteLine(" <ItemGroup>"); 493 ps.WriteLine(" <ItemGroup>");
494 foreach (ReferenceNode refr in project.References) 494 foreach (ReferenceNode refr in project.References)
495 { 495 {
496 if (solution.ProjectsTable.ContainsKey(refr.Name)) 496 if (solution.ProjectsTable.ContainsKey(refr.Name))
497 { 497 {
498 ProjectNode refProject = (ProjectNode)solution.ProjectsTable[refr.Name]; 498 ProjectNode refProject = (ProjectNode)solution.ProjectsTable[refr.Name];
499 // TODO: Allow reference to visual basic projects 499 // TODO: Allow reference to visual basic projects
500 string path = 500 string path =
501 Helper.MakePathRelativeTo(project.FullPath, 501 Helper.MakePathRelativeTo(project.FullPath,
502 Helper.MakeFilePath(refProject.FullPath, refProject.Name, "csproj")); 502 Helper.MakeFilePath(refProject.FullPath, refProject.Name, "csproj"));
503 ps.WriteLine(" <ProjectReference Include=\"{0}\">", path ); 503 ps.WriteLine(" <ProjectReference Include=\"{0}\">", path );
504 //<ProjectReference Include="..\..\RealmForge\Utility\RealmForge.Utility.csproj"> 504 //<ProjectReference Include="..\..\RealmForge\Utility\RealmForge.Utility.csproj">
505 ps.WriteLine(" <Name>{0}</Name>", refProject.Name); 505 ps.WriteLine(" <Name>{0}</Name>", refProject.Name);
506 // <Name>RealmForge.Utility</Name> 506 // <Name>RealmForge.Utility</Name>
507 ps.WriteLine(" <Project>{{{0}}}</Project>", refProject.Guid.ToString().ToUpper()); 507 ps.WriteLine(" <Project>{{{0}}}</Project>", refProject.Guid.ToString().ToUpper());
508 // <Project>{6880D1D3-69EE-461B-B841-5319845B20D3}</Project> 508 // <Project>{6880D1D3-69EE-461B-B841-5319845B20D3}</Project>
509 ps.WriteLine(" <Package>{0}</Package>", toolInfo.Guid.ToString().ToUpper()); 509 ps.WriteLine(" <Package>{0}</Package>", toolInfo.Guid.ToString().ToUpper());
510 // <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> 510 // <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
511 ps.WriteLine("\t\t\t<Private>{0}</Private>", refr.LocalCopy); 511 ps.WriteLine("\t\t\t<Private>{0}</Private>", refr.LocalCopy);
512 ps.WriteLine(" </ProjectReference>"); 512 ps.WriteLine(" </ProjectReference>");
513 //</ProjectReference> 513 //</ProjectReference>
514 } 514 }
515 else 515 else
516 { 516 {
517 } 517 }
518 } 518 }
519 ps.WriteLine(" </ItemGroup>"); 519 ps.WriteLine(" </ItemGroup>");
520 520
521 // ps.WriteLine(" </Build>"); 521 // ps.WriteLine(" </Build>");
522 ps.WriteLine(" <ItemGroup>"); 522 ps.WriteLine(" <ItemGroup>");
523 523
524 // ps.WriteLine(" <Include>"); 524 // ps.WriteLine(" <Include>");
525 ArrayList list = new ArrayList(); 525 ArrayList list = new ArrayList();
526 foreach (string file in project.Files) 526 foreach (string file in project.Files)
527 { 527 {
528 // if (file == "Properties\\Bind.Designer.cs") 528 // if (file == "Properties\\Bind.Designer.cs")
529 // { 529 // {
530 // Console.WriteLine("Wait a minute!"); 530 // Console.WriteLine("Wait a minute!");
531 // Console.WriteLine(project.Files.GetSubType(file).ToString()); 531 // Console.WriteLine(project.Files.GetSubType(file).ToString());
532 // } 532 // }
533 533
534 if (project.Files.GetSubType(file) != SubType.Code && project.Files.GetSubType(file) != SubType.Settings && project.Files.GetSubType(file) != SubType.Designer) 534 if (project.Files.GetSubType(file) != SubType.Code && project.Files.GetSubType(file) != SubType.Settings && project.Files.GetSubType(file) != SubType.Designer)
535 { 535 {
536 ps.WriteLine(" <EmbeddedResource Include=\"{0}\">", file.Substring(0, file.LastIndexOf('.')) + ".resx"); 536 ps.WriteLine(" <EmbeddedResource Include=\"{0}\">", file.Substring(0, file.LastIndexOf('.')) + ".resx");
537 537
538 int slash = file.LastIndexOf('\\'); 538 int slash = file.LastIndexOf('\\');
539 if (slash == -1) 539 if (slash == -1)
540 { 540 {
541 ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", file); 541 ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", file);
542 } 542 }
543 else 543 else
544 { 544 {
545 ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", file.Substring(slash + 1, file.Length - slash - 1)); 545 ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", file.Substring(slash + 1, file.Length - slash - 1));
546 } 546 }
547 ps.WriteLine(" <SubType>Designer</SubType>"); 547 ps.WriteLine(" <SubType>Designer</SubType>");
548 ps.WriteLine(" </EmbeddedResource>"); 548 ps.WriteLine(" </EmbeddedResource>");
549 // 549 //
550 } 550 }
551 551
552 if (project.Files.GetSubType(file) != SubType.Code && project.Files.GetSubType(file) == SubType.Designer) 552 if (project.Files.GetSubType(file) != SubType.Code && project.Files.GetSubType(file) == SubType.Designer)
553 { 553 {
554 ps.WriteLine(" <EmbeddedResource Include=\"{0}\">", file.Substring(0, file.LastIndexOf('.')) + ".resx"); 554 ps.WriteLine(" <EmbeddedResource Include=\"{0}\">", file.Substring(0, file.LastIndexOf('.')) + ".resx");
555 ps.WriteLine(" <SubType>" + project.Files.GetSubType(file) + "</SubType>"); 555 ps.WriteLine(" <SubType>" + project.Files.GetSubType(file) + "</SubType>");
556 ps.WriteLine(" <Generator>ResXFileCodeGenerator</Generator>"); 556 ps.WriteLine(" <Generator>ResXFileCodeGenerator</Generator>");
557 ps.WriteLine(" <LastGenOutput>Resources.Designer.cs</LastGenOutput>"); 557 ps.WriteLine(" <LastGenOutput>Resources.Designer.cs</LastGenOutput>");
558 ps.WriteLine(" </EmbeddedResource>"); 558 ps.WriteLine(" </EmbeddedResource>");
559 ps.WriteLine(" <Compile Include=\"{0}\">", file.Substring(0, file.LastIndexOf('.')) + ".Designer.cs"); 559 ps.WriteLine(" <Compile Include=\"{0}\">", file.Substring(0, file.LastIndexOf('.')) + ".Designer.cs");
560 ps.WriteLine(" <AutoGen>True</AutoGen>"); 560 ps.WriteLine(" <AutoGen>True</AutoGen>");
561 ps.WriteLine(" <DesignTime>True</DesignTime>"); 561 ps.WriteLine(" <DesignTime>True</DesignTime>");
562 ps.WriteLine(" <DependentUpon>Resources.resx</DependentUpon>"); 562 ps.WriteLine(" <DependentUpon>Resources.resx</DependentUpon>");
563 ps.WriteLine(" </Compile>"); 563 ps.WriteLine(" </Compile>");
564 list.Add(file.Substring(0, file.LastIndexOf('.')) + ".Designer.cs"); 564 list.Add(file.Substring(0, file.LastIndexOf('.')) + ".Designer.cs");
565 } 565 }
566 if (project.Files.GetSubType(file).ToString() == "Settings") 566 if (project.Files.GetSubType(file).ToString() == "Settings")
567 { 567 {
568 //Console.WriteLine("File: " + file); 568 //Console.WriteLine("File: " + file);
569 //Console.WriteLine("Last index: " + file.LastIndexOf('.')); 569 //Console.WriteLine("Last index: " + file.LastIndexOf('.'));
570 //Console.WriteLine("Length: " + file.Length); 570 //Console.WriteLine("Length: " + file.Length);
571 ps.Write(" <{0} ", project.Files.GetBuildAction(file)); 571 ps.Write(" <{0} ", project.Files.GetBuildAction(file));
572 ps.WriteLine("Include=\"{0}\">", file); 572 ps.WriteLine("Include=\"{0}\">", file);
573 int slash = file.LastIndexOf('\\'); 573 int slash = file.LastIndexOf('\\');
574 string fileName = file.Substring(slash + 1, file.Length - slash - 1); 574 string fileName = file.Substring(slash + 1, file.Length - slash - 1);
575 if (project.Files.GetBuildAction(file) == BuildAction.None) 575 if (project.Files.GetBuildAction(file) == BuildAction.None)
576 { 576 {
577 ps.WriteLine(" <Generator>SettingsSingleFileGenerator</Generator>"); 577 ps.WriteLine(" <Generator>SettingsSingleFileGenerator</Generator>");
578 578
579 //Console.WriteLine("FileName: " + fileName); 579 //Console.WriteLine("FileName: " + fileName);
580 //Console.WriteLine("FileNameMain: " + fileName.Substring(0, fileName.LastIndexOf('.'))); 580 //Console.WriteLine("FileNameMain: " + fileName.Substring(0, fileName.LastIndexOf('.')));
581 //Console.WriteLine("FileNameExt: " + fileName.Substring(fileName.LastIndexOf('.'), fileName.Length - fileName.LastIndexOf('.'))); 581 //Console.WriteLine("FileNameExt: " + fileName.Substring(fileName.LastIndexOf('.'), fileName.Length - fileName.LastIndexOf('.')));
582 if (slash == -1) 582 if (slash == -1)
583 { 583 {
584 ps.WriteLine(" <LastGenOutput>{0}</LastGenOutput>", fileName.Substring(0, fileName.LastIndexOf('.')) + ".Designer.cs"); 584 ps.WriteLine(" <LastGenOutput>{0}</LastGenOutput>", fileName.Substring(0, fileName.LastIndexOf('.')) + ".Designer.cs");
585 } 585 }
586 else 586 else
587 { 587 {
588 ps.WriteLine(" <LastGenOutput>{0}</LastGenOutput>", fileName.Substring(0, fileName.LastIndexOf('.')) + ".Designer.cs"); 588 ps.WriteLine(" <LastGenOutput>{0}</LastGenOutput>", fileName.Substring(0, fileName.LastIndexOf('.')) + ".Designer.cs");
589 } 589 }
590 } 590 }
591 else 591 else
592 { 592 {
593 ps.WriteLine(" <SubType>Code</SubType>"); 593 ps.WriteLine(" <SubType>Code</SubType>");
594 ps.WriteLine(" <AutoGen>True</AutoGen>"); 594 ps.WriteLine(" <AutoGen>True</AutoGen>");
595 ps.WriteLine(" <DesignTimeSharedInput>True</DesignTimeSharedInput>"); 595 ps.WriteLine(" <DesignTimeSharedInput>True</DesignTimeSharedInput>");
596 string fileNameShort = fileName.Substring(0, fileName.LastIndexOf('.')); 596 string fileNameShort = fileName.Substring(0, fileName.LastIndexOf('.'));
597 string fileNameShorter = fileNameShort.Substring(0, fileNameShort.LastIndexOf('.')); 597 string fileNameShorter = fileNameShort.Substring(0, fileNameShort.LastIndexOf('.'));
598 ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", fileNameShorter + ".settings"); 598 ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", fileNameShorter + ".settings");
599 } 599 }
600 ps.WriteLine(" </{0}>", project.Files.GetBuildAction(file)); 600 ps.WriteLine(" </{0}>", project.Files.GetBuildAction(file));
601 } 601 }
602 else if (project.Files.GetSubType(file) != SubType.Designer) 602 else if (project.Files.GetSubType(file) != SubType.Designer)
603 { 603 {
604 if (!list.Contains(file)) 604 if (!list.Contains(file))
605 { 605 {
606 ps.Write(" <{0} ", project.Files.GetBuildAction(file)); 606 ps.Write(" <{0} ", project.Files.GetBuildAction(file));
607 ps.WriteLine("Include=\"{0}\">", file); 607 ps.WriteLine("Include=\"{0}\">", file);
608 608
609 609
610 if (file.Contains("Designer.cs")) 610 if (file.Contains("Designer.cs"))
611 { 611 {
612 ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", file.Substring(0, file.IndexOf(".Designer.cs")) + ".cs"); 612 ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", file.Substring(0, file.IndexOf(".Designer.cs")) + ".cs");
613 } 613 }
614 614
615 if (project.Files.GetIsLink(file)) 615 if (project.Files.GetIsLink(file))
616 { 616 {
617 ps.WriteLine(" <Link>{0}</Link>", Path.GetFileName(file)); 617 ps.WriteLine(" <Link>{0}</Link>", Path.GetFileName(file));
618 } 618 }
619 else if (project.Files.GetBuildAction(file) != BuildAction.None) 619 else if (project.Files.GetBuildAction(file) != BuildAction.None)
620 { 620 {
621 if (project.Files.GetBuildAction(file) != BuildAction.EmbeddedResource) 621 if (project.Files.GetBuildAction(file) != BuildAction.EmbeddedResource)
622 { 622 {
623 ps.WriteLine(" <SubType>{0}</SubType>", project.Files.GetSubType(file)); 623 ps.WriteLine(" <SubType>{0}</SubType>", project.Files.GetSubType(file));
624 } 624 }
625 } 625 }
626 if (project.Files.GetCopyToOutput(file) != CopyToOutput.Never) 626 if (project.Files.GetCopyToOutput(file) != CopyToOutput.Never)
627 { 627 {
628 ps.WriteLine(" <CopyToOutputDirectory>{0}</CopyToOutputDirectory>", project.Files.GetCopyToOutput(file)); 628 ps.WriteLine(" <CopyToOutputDirectory>{0}</CopyToOutputDirectory>", project.Files.GetCopyToOutput(file));
629 } 629 }
630 630
631 ps.WriteLine(" </{0}>", project.Files.GetBuildAction(file)); 631 ps.WriteLine(" </{0}>", project.Files.GetBuildAction(file));
632 } 632 }
633 } 633 }
634 } 634 }
635 // ps.WriteLine(" </Include>"); 635 // ps.WriteLine(" </Include>");
636 636
637 ps.WriteLine(" </ItemGroup>"); 637 ps.WriteLine(" </ItemGroup>");
638 ps.WriteLine(" <Import Project=\"" + toolInfo.ImportProject + "\" />"); 638 ps.WriteLine(" <Import Project=\"" + toolInfo.ImportProject + "\" />");
639 ps.WriteLine(" <PropertyGroup>"); 639 ps.WriteLine(" <PropertyGroup>");
640 ps.WriteLine(" <PreBuildEvent>"); 640 ps.WriteLine(" <PreBuildEvent>");
641 ps.WriteLine(" </PreBuildEvent>"); 641 ps.WriteLine(" </PreBuildEvent>");
642 ps.WriteLine(" <PostBuildEvent>"); 642 ps.WriteLine(" <PostBuildEvent>");
643 ps.WriteLine(" </PostBuildEvent>"); 643 ps.WriteLine(" </PostBuildEvent>");
644 ps.WriteLine(" </PropertyGroup>"); 644 ps.WriteLine(" </PropertyGroup>");
645 // ps.WriteLine(" </{0}>", toolInfo.XMLTag); 645 // ps.WriteLine(" </{0}>", toolInfo.XMLTag);
646 ps.WriteLine("</Project>"); 646 ps.WriteLine("</Project>");
647 } 647 }
648 #endregion 648 #endregion
649 649
650 #region User File 650 #region User File
651 651
652 ps = new StreamWriter(projectFile + ".user"); 652 ps = new StreamWriter(projectFile + ".user");
653 using (ps) 653 using (ps)
654 { 654 {
655 ps.WriteLine("<Project xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">"); 655 ps.WriteLine("<Project xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">");
656 //ps.WriteLine( "<VisualStudioProject>" ); 656 //ps.WriteLine( "<VisualStudioProject>" );
657 //ps.WriteLine(" <{0}>", toolInfo.XMLTag); 657 //ps.WriteLine(" <{0}>", toolInfo.XMLTag);
658 //ps.WriteLine(" <Build>"); 658 //ps.WriteLine(" <Build>");
659 ps.WriteLine(" <PropertyGroup>"); 659 ps.WriteLine(" <PropertyGroup>");
660 //ps.WriteLine(" <Settings ReferencePath=\"{0}\">", MakeRefPath(project)); 660 //ps.WriteLine(" <Settings ReferencePath=\"{0}\">", MakeRefPath(project));
661 661
662 662
663 ps.WriteLine(" <Configuration Condition=\" '$(Configuration)' == '' \">Debug</Configuration>"); 663 ps.WriteLine(" <Configuration Condition=\" '$(Configuration)' == '' \">Debug</Configuration>");
664 ps.WriteLine(" <Platform Condition=\" '$(Platform)' == '' \">AnyCPU</Platform>"); 664 ps.WriteLine(" <Platform Condition=\" '$(Platform)' == '' \">AnyCPU</Platform>");
665 665
666 if (projectFile.Contains( "OpenSim.csproj" )) 666 if (projectFile.Contains( "OpenSim.csproj" ))
667 { 667 {
668 ps.WriteLine(" <StartArguments>-loginserver -sandbox -accounts</StartArguments>"); 668 ps.WriteLine(" <StartArguments>-loginserver -sandbox -accounts</StartArguments>");
669 } 669 }
670 670
671 ps.WriteLine(" <ReferencePath>{0}</ReferencePath>", MakeRefPath(project)); 671 ps.WriteLine(" <ReferencePath>{0}</ReferencePath>", MakeRefPath(project));
672 ps.WriteLine(" <LastOpenVersion>{0}</LastOpenVersion>", this.ProductVersion); 672 ps.WriteLine(" <LastOpenVersion>{0}</LastOpenVersion>", this.ProductVersion);
673 ps.WriteLine(" <ProjectView>ProjectFiles</ProjectView>"); 673 ps.WriteLine(" <ProjectView>ProjectFiles</ProjectView>");
674 ps.WriteLine(" <ProjectTrust>0</ProjectTrust>"); 674 ps.WriteLine(" <ProjectTrust>0</ProjectTrust>");
675 ps.WriteLine(" </PropertyGroup>"); 675 ps.WriteLine(" </PropertyGroup>");
676 foreach (ConfigurationNode conf in project.Configurations) 676 foreach (ConfigurationNode conf in project.Configurations)
677 { 677 {
678 ps.Write(" <PropertyGroup"); 678 ps.Write(" <PropertyGroup");
679 ps.Write(" Condition = \" '$(Configuration)|$(Platform)' == '{0}|AnyCPU' \"", conf.Name); 679 ps.Write(" Condition = \" '$(Configuration)|$(Platform)' == '{0}|AnyCPU' \"", conf.Name);
680 ps.WriteLine(" />"); 680 ps.WriteLine(" />");
681 } 681 }
682 682
683 ps.WriteLine("</Project>"); 683 ps.WriteLine("</Project>");
684 } 684 }
685 #endregion 685 #endregion
686 686
687 kernel.CurrentWorkingDirectory.Pop(); 687 kernel.CurrentWorkingDirectory.Pop();
688 } 688 }
689 689
690 private void WriteSolution(SolutionNode solution) 690 private void WriteSolution(SolutionNode solution)
691 { 691 {
692 kernel.Log.Write("Creating {0} solution and project files", this.VersionName); 692 kernel.Log.Write("Creating {0} solution and project files", this.VersionName);
693 693
694 foreach (ProjectNode project in solution.Projects) 694 foreach (ProjectNode project in solution.Projects)
695 { 695 {
696 kernel.Log.Write("...Creating project: {0}", project.Name); 696 kernel.Log.Write("...Creating project: {0}", project.Name);
697 WriteProject(solution, project); 697 WriteProject(solution, project);
698 } 698 }
699 699
700 kernel.Log.Write(""); 700 kernel.Log.Write("");
701 string solutionFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "sln"); 701 string solutionFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "sln");
702 StreamWriter ss = new StreamWriter(solutionFile); 702 StreamWriter ss = new StreamWriter(solutionFile);
703 703
704 kernel.CurrentWorkingDirectory.Push(); 704 kernel.CurrentWorkingDirectory.Push();
705 Helper.SetCurrentDir(Path.GetDirectoryName(solutionFile)); 705 Helper.SetCurrentDir(Path.GetDirectoryName(solutionFile));
706 706
707 using (ss) 707 using (ss)
708 { 708 {
709 ss.WriteLine("Microsoft Visual Studio Solution File, Format Version {0}", this.SolutionVersion); 709 ss.WriteLine("Microsoft Visual Studio Solution File, Format Version {0}", this.SolutionVersion);
710 ss.WriteLine("# Visual Studio 2005"); 710 ss.WriteLine("# Visual Studio 2005");
711 foreach (ProjectNode project in solution.Projects) 711 foreach (ProjectNode project in solution.Projects)
712 { 712 {
713 if (!tools.ContainsKey(project.Language)) 713 if (!tools.ContainsKey(project.Language))
714 { 714 {
715 throw new UnknownLanguageException("Unknown .NET language: " + project.Language); 715 throw new UnknownLanguageException("Unknown .NET language: " + project.Language);
716 } 716 }
717 717
718 ToolInfo toolInfo = (ToolInfo)tools[project.Language]; 718 ToolInfo toolInfo = (ToolInfo)tools[project.Language];
719 719
720 string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); 720 string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath);
721 ss.WriteLine("Project(\"{0}\") = \"{1}\", \"{2}\", \"{{{3}}}\"", 721 ss.WriteLine("Project(\"{0}\") = \"{1}\", \"{2}\", \"{{{3}}}\"",
722 toolInfo.Guid, project.Name, Helper.MakeFilePath(path, project.Name, 722 toolInfo.Guid, project.Name, Helper.MakeFilePath(path, project.Name,
723 toolInfo.FileExtension), project.Guid.ToString().ToUpper()); 723 toolInfo.FileExtension), project.Guid.ToString().ToUpper());
724 724
725 //ss.WriteLine(" ProjectSection(ProjectDependencies) = postProject"); 725 //ss.WriteLine(" ProjectSection(ProjectDependencies) = postProject");
726 //ss.WriteLine(" EndProjectSection"); 726 //ss.WriteLine(" EndProjectSection");
727 727
728 ss.WriteLine("EndProject"); 728 ss.WriteLine("EndProject");
729 } 729 }
730 730
731 if (solution.Files != null) 731 if (solution.Files != null)
732 { 732 {
733 ss.WriteLine("Project(\"{0}\") = \"Solution Items\", \"Solution Items\", \"{1}\"", "{2150E333-8FDC-42A3-9474-1A3956D46DE8}", "{468F1D07-AD17-4CC3-ABD0-2CA268E4E1A6}"); 733 ss.WriteLine("Project(\"{0}\") = \"Solution Items\", \"Solution Items\", \"{1}\"", "{2150E333-8FDC-42A3-9474-1A3956D46DE8}", "{468F1D07-AD17-4CC3-ABD0-2CA268E4E1A6}");
734 ss.WriteLine("\tProjectSection(SolutionItems) = preProject"); 734 ss.WriteLine("\tProjectSection(SolutionItems) = preProject");
735 foreach (string file in solution.Files) 735 foreach (string file in solution.Files)
736 ss.WriteLine("\t\t{0} = {0}", file); 736 ss.WriteLine("\t\t{0} = {0}", file);
737 ss.WriteLine("\tEndProjectSection"); 737 ss.WriteLine("\tEndProjectSection");
738 ss.WriteLine("EndProject"); 738 ss.WriteLine("EndProject");
739 } 739 }
740 740
741 ss.WriteLine("Global"); 741 ss.WriteLine("Global");
742 742
743 ss.WriteLine(" GlobalSection(SolutionConfigurationPlatforms) = preSolution"); 743 ss.WriteLine(" GlobalSection(SolutionConfigurationPlatforms) = preSolution");
744 foreach (ConfigurationNode conf in solution.Configurations) 744 foreach (ConfigurationNode conf in solution.Configurations)
745 { 745 {
746 ss.WriteLine(" {0}|Any CPU = {0}|Any CPU", conf.Name); 746 ss.WriteLine(" {0}|Any CPU = {0}|Any CPU", conf.Name);
747 } 747 }
748 ss.WriteLine(" EndGlobalSection"); 748 ss.WriteLine(" EndGlobalSection");
749 749
750 if (solution.Projects.Count > 1) 750 if (solution.Projects.Count > 1)
751 { 751 {
752 ss.WriteLine(" GlobalSection(ProjectDependencies) = postSolution"); 752 ss.WriteLine(" GlobalSection(ProjectDependencies) = postSolution");
753 } 753 }
754 foreach (ProjectNode project in solution.Projects) 754 foreach (ProjectNode project in solution.Projects)
755 { 755 {
756 for (int i = 0; i < project.References.Count; i++) 756 for (int i = 0; i < project.References.Count; i++)
757 { 757 {
758 ReferenceNode refr = (ReferenceNode)project.References[i]; 758 ReferenceNode refr = (ReferenceNode)project.References[i];
759 if (solution.ProjectsTable.ContainsKey(refr.Name)) 759 if (solution.ProjectsTable.ContainsKey(refr.Name))
760 { 760 {
761 ProjectNode refProject = (ProjectNode)solution.ProjectsTable[refr.Name]; 761 ProjectNode refProject = (ProjectNode)solution.ProjectsTable[refr.Name];
762 ss.WriteLine(" ({{{0}}}).{1} = ({{{2}}})", 762 ss.WriteLine(" ({{{0}}}).{1} = ({{{2}}})",
763 project.Guid.ToString().ToUpper() 763 project.Guid.ToString().ToUpper()
764 , i, 764 , i,
765 refProject.Guid.ToString().ToUpper() 765 refProject.Guid.ToString().ToUpper()
766 ); 766 );
767 } 767 }
768 } 768 }
769 } 769 }
770 if (solution.Projects.Count > 1) 770 if (solution.Projects.Count > 1)
771 { 771 {
772 ss.WriteLine(" EndGlobalSection"); 772 ss.WriteLine(" EndGlobalSection");
773 } 773 }
774 ss.WriteLine(" GlobalSection(ProjectConfigurationPlatforms) = postSolution"); 774 ss.WriteLine(" GlobalSection(ProjectConfigurationPlatforms) = postSolution");
775 foreach (ProjectNode project in solution.Projects) 775 foreach (ProjectNode project in solution.Projects)
776 { 776 {
777 foreach (ConfigurationNode conf in solution.Configurations) 777 foreach (ConfigurationNode conf in solution.Configurations)
778 { 778 {
779 ss.WriteLine(" {{{0}}}.{1}|Any CPU.ActiveCfg = {1}|Any CPU", 779 ss.WriteLine(" {{{0}}}.{1}|Any CPU.ActiveCfg = {1}|Any CPU",
780 project.Guid.ToString().ToUpper(), 780 project.Guid.ToString().ToUpper(),
781 conf.Name); 781 conf.Name);
782 782
783 ss.WriteLine(" {{{0}}}.{1}|Any CPU.Build.0 = {1}|Any CPU", 783 ss.WriteLine(" {{{0}}}.{1}|Any CPU.Build.0 = {1}|Any CPU",
784 project.Guid.ToString().ToUpper(), 784 project.Guid.ToString().ToUpper(),
785 conf.Name); 785 conf.Name);
786 } 786 }
787 } 787 }
788 ss.WriteLine(" EndGlobalSection"); 788 ss.WriteLine(" EndGlobalSection");
789 ss.WriteLine(" GlobalSection(SolutionProperties) = preSolution"); 789 ss.WriteLine(" GlobalSection(SolutionProperties) = preSolution");
790 ss.WriteLine(" HideSolutionNode = FALSE"); 790 ss.WriteLine(" HideSolutionNode = FALSE");
791 ss.WriteLine(" EndGlobalSection"); 791 ss.WriteLine(" EndGlobalSection");
792 792
793 ss.WriteLine("EndGlobal"); 793 ss.WriteLine("EndGlobal");
794 } 794 }
795 795
796 kernel.CurrentWorkingDirectory.Pop(); 796 kernel.CurrentWorkingDirectory.Pop();
797 } 797 }
798 798
799 private void CleanProject(ProjectNode project) 799 private void CleanProject(ProjectNode project)
800 { 800 {
801 kernel.Log.Write("...Cleaning project: {0}", project.Name); 801 kernel.Log.Write("...Cleaning project: {0}", project.Name);
802 802
803 ToolInfo toolInfo = (ToolInfo)tools[project.Language]; 803 ToolInfo toolInfo = (ToolInfo)tools[project.Language];
804 string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, toolInfo.FileExtension); 804 string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, toolInfo.FileExtension);
805 string userFile = projectFile + ".user"; 805 string userFile = projectFile + ".user";
806 806
807 Helper.DeleteIfExists(projectFile); 807 Helper.DeleteIfExists(projectFile);
808 Helper.DeleteIfExists(userFile); 808 Helper.DeleteIfExists(userFile);
809 } 809 }
810 810
811 private void CleanSolution(SolutionNode solution) 811 private void CleanSolution(SolutionNode solution)
812 { 812 {
813 kernel.Log.Write("Cleaning {0} solution and project files", this.VersionName, solution.Name); 813 kernel.Log.Write("Cleaning {0} solution and project files", this.VersionName, solution.Name);
814 814
815 string slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "sln"); 815 string slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "sln");
816 string suoFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "suo"); 816 string suoFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "suo");
817 817
818 Helper.DeleteIfExists(slnFile); 818 Helper.DeleteIfExists(slnFile);
819 Helper.DeleteIfExists(suoFile); 819 Helper.DeleteIfExists(suoFile);
820 820
821 foreach (ProjectNode project in solution.Projects) 821 foreach (ProjectNode project in solution.Projects)
822 { 822 {
823 CleanProject(project); 823 CleanProject(project);
824 } 824 }
825 825
826 kernel.Log.Write(""); 826 kernel.Log.Write("");
827 } 827 }
828 828
829 #endregion 829 #endregion
830 830
831 #region ITarget Members 831 #region ITarget Members
832 832
833 /// <summary> 833 /// <summary>
834 /// Writes the specified kern. 834 /// Writes the specified kern.
835 /// </summary> 835 /// </summary>
836 /// <param name="kern">The kern.</param> 836 /// <param name="kern">The kern.</param>
837 public virtual void Write(Kernel kern) 837 public virtual void Write(Kernel kern)
838 { 838 {
839 if (kern == null) 839 if (kern == null)
840 { 840 {
841 throw new ArgumentNullException("kern"); 841 throw new ArgumentNullException("kern");
842 } 842 }
843 kernel = kern; 843 kernel = kern;
844 foreach (SolutionNode sol in kernel.Solutions) 844 foreach (SolutionNode sol in kernel.Solutions)
845 { 845 {
846 WriteSolution(sol); 846 WriteSolution(sol);
847 } 847 }
848 kernel = null; 848 kernel = null;
849 } 849 }
850 850
851 /// <summary> 851 /// <summary>
852 /// Cleans the specified kern. 852 /// Cleans the specified kern.
853 /// </summary> 853 /// </summary>
854 /// <param name="kern">The kern.</param> 854 /// <param name="kern">The kern.</param>
855 public virtual void Clean(Kernel kern) 855 public virtual void Clean(Kernel kern)
856 { 856 {
857 if (kern == null) 857 if (kern == null)
858 { 858 {
859 throw new ArgumentNullException("kern"); 859 throw new ArgumentNullException("kern");
860 } 860 }
861 kernel = kern; 861 kernel = kern;
862 foreach (SolutionNode sol in kernel.Solutions) 862 foreach (SolutionNode sol in kernel.Solutions)
863 { 863 {
864 CleanSolution(sol); 864 CleanSolution(sol);
865 } 865 }
866 kernel = null; 866 kernel = null;
867 } 867 }
868 868
869 /// <summary> 869 /// <summary>
870 /// Gets the name. 870 /// Gets the name.
871 /// </summary> 871 /// </summary>
872 /// <value>The name.</value> 872 /// <value>The name.</value>
873 public virtual string Name 873 public virtual string Name
874 { 874 {
875 get 875 get
876 { 876 {
877 return "vs2005"; 877 return "vs2005";
878 } 878 }
879 } 879 }
880 880
881 #endregion 881 #endregion
882 } 882 }
883} 883}