aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Prebuild/src/Core/Targets/VS2003Target.cs
diff options
context:
space:
mode:
authoronefang2019-05-19 21:24:15 +1000
committeronefang2019-05-19 21:24:15 +1000
commit5e4d6cab00cb29cd088ab7b62ab13aff103b64cb (patch)
treea9fbc62df9eb2d1d9ba2698d8552eae71eca20d8 /Prebuild/src/Core/Targets/VS2003Target.cs
parentAdd a build script. (diff)
downloadopensim-SC_OLD-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.zip
opensim-SC_OLD-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.tar.gz
opensim-SC_OLD-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.tar.bz2
opensim-SC_OLD-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.tar.xz
Dump OpenSim 0.9.0.1 into it's own branch.
Diffstat (limited to 'Prebuild/src/Core/Targets/VS2003Target.cs')
-rw-r--r--Prebuild/src/Core/Targets/VS2003Target.cs1132
1 files changed, 566 insertions, 566 deletions
diff --git a/Prebuild/src/Core/Targets/VS2003Target.cs b/Prebuild/src/Core/Targets/VS2003Target.cs
index 10e2dc4..f4b4517 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}