diff options
Diffstat (limited to 'Prebuild/src/Core/Targets/VS2005Target.cs')
-rw-r--r-- | Prebuild/src/Core/Targets/VS2005Target.cs | 89 |
1 files changed, 55 insertions, 34 deletions
diff --git a/Prebuild/src/Core/Targets/VS2005Target.cs b/Prebuild/src/Core/Targets/VS2005Target.cs index bd56beb..4c17a3a 100644 --- a/Prebuild/src/Core/Targets/VS2005Target.cs +++ b/Prebuild/src/Core/Targets/VS2005Target.cs | |||
@@ -26,9 +26,9 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O | |||
26 | #region CVS Information | 26 | #region CVS Information |
27 | /* | 27 | /* |
28 | * $Source$ | 28 | * $Source$ |
29 | * $Author: robloach $ | 29 | * $Author: borrillis $ |
30 | * $Date: 2007-02-27 19:52:34 +0100 (ti, 27 feb 2007) $ | 30 | * $Date: 2007-05-25 01:03:16 +0900 (Fri, 25 May 2007) $ |
31 | * $Revision: 207 $ | 31 | * $Revision: 243 $ |
32 | */ | 32 | */ |
33 | #endregion | 33 | #endregion |
34 | 34 | ||
@@ -36,6 +36,7 @@ using System; | |||
36 | using System.Collections; | 36 | using System.Collections; |
37 | using System.Collections.Specialized; | 37 | using System.Collections.Specialized; |
38 | using System.IO; | 38 | using System.IO; |
39 | using System.Text; | ||
39 | 40 | ||
40 | using Prebuild.Core.Attributes; | 41 | using Prebuild.Core.Attributes; |
41 | using Prebuild.Core.Interfaces; | 42 | using Prebuild.Core.Interfaces; |
@@ -235,7 +236,7 @@ namespace Prebuild.Core.Targets | |||
235 | 236 | ||
236 | Hashtable tools; | 237 | Hashtable tools; |
237 | Kernel kernel; | 238 | Kernel kernel; |
238 | 239 | ||
239 | protected virtual string ToolsVersionXml | 240 | protected virtual string ToolsVersionXml |
240 | { | 241 | { |
241 | get | 242 | get |
@@ -249,7 +250,7 @@ namespace Prebuild.Core.Targets | |||
249 | get { return "# Visual Studio 2005"; } | 250 | get { return "# Visual Studio 2005"; } |
250 | } | 251 | } |
251 | 252 | ||
252 | /// <summary> | 253 | /// <summary> |
253 | /// Gets or sets the solution version. | 254 | /// Gets or sets the solution version. |
254 | /// </summary> | 255 | /// </summary> |
255 | /// <value>The solution version.</value> | 256 | /// <value>The solution version.</value> |
@@ -260,6 +261,7 @@ namespace Prebuild.Core.Targets | |||
260 | return "9.00"; | 261 | return "9.00"; |
261 | } | 262 | } |
262 | } | 263 | } |
264 | |||
263 | /// <summary> | 265 | /// <summary> |
264 | /// Gets or sets the product version. | 266 | /// Gets or sets the product version. |
265 | /// </summary> | 267 | /// </summary> |
@@ -287,6 +289,7 @@ namespace Prebuild.Core.Targets | |||
287 | this.schemaVersion = value; | 289 | this.schemaVersion = value; |
288 | } | 290 | } |
289 | } | 291 | } |
292 | |||
290 | /// <summary> | 293 | /// <summary> |
291 | /// Gets or sets the name of the version. | 294 | /// Gets or sets the name of the version. |
292 | /// </summary> | 295 | /// </summary> |
@@ -298,6 +301,7 @@ namespace Prebuild.Core.Targets | |||
298 | return "Visual C# 2005"; | 301 | return "Visual C# 2005"; |
299 | } | 302 | } |
300 | } | 303 | } |
304 | |||
301 | /// <summary> | 305 | /// <summary> |
302 | /// Gets or sets the version. | 306 | /// Gets or sets the version. |
303 | /// </summary> | 307 | /// </summary> |
@@ -377,7 +381,7 @@ namespace Prebuild.Core.Targets | |||
377 | #region Project File | 381 | #region Project File |
378 | using (ps) | 382 | using (ps) |
379 | { | 383 | { |
380 | ps.WriteLine("<Project DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\"{0}>", ToolsVersionXml ); | 384 | ps.WriteLine("<Project DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\"{0}>", ToolsVersionXml); |
381 | //ps.WriteLine(" <{0}", toolInfo.XMLTag); | 385 | //ps.WriteLine(" <{0}", toolInfo.XMLTag); |
382 | ps.WriteLine(" <PropertyGroup>"); | 386 | ps.WriteLine(" <PropertyGroup>"); |
383 | ps.WriteLine(" <ProjectType>Local</ProjectType>"); | 387 | ps.WriteLine(" <ProjectType>Local</ProjectType>"); |
@@ -431,7 +435,7 @@ namespace Prebuild.Core.Targets | |||
431 | ps.WriteLine(" <ConfigurationOverrideFile>"); | 435 | ps.WriteLine(" <ConfigurationOverrideFile>"); |
432 | ps.WriteLine(" </ConfigurationOverrideFile>"); | 436 | ps.WriteLine(" </ConfigurationOverrideFile>"); |
433 | ps.WriteLine(" <DefineConstants>{0}</DefineConstants>", conf.Options["CompilerDefines"]); | 437 | ps.WriteLine(" <DefineConstants>{0}</DefineConstants>", conf.Options["CompilerDefines"]); |
434 | ps.WriteLine(" <DocumentationFile>{0}</DocumentationFile>", conf.Options["XmlDocFile"]); | 438 | ps.WriteLine(" <DocumentationFile>{0}</DocumentationFile>", Helper.NormalizePath(conf.Options["XmlDocFile"].ToString())); |
435 | ps.WriteLine(" <DebugSymbols>{0}</DebugSymbols>", conf.Options["DebugInformation"]); | 439 | ps.WriteLine(" <DebugSymbols>{0}</DebugSymbols>", conf.Options["DebugInformation"]); |
436 | ps.WriteLine(" <FileAlignment>{0}</FileAlignment>", conf.Options["FileAlignment"]); | 440 | ps.WriteLine(" <FileAlignment>{0}</FileAlignment>", conf.Options["FileAlignment"]); |
437 | // ps.WriteLine(" <IncrementalBuild = \"{0}\"", conf.Options["IncrementalBuild"]); | 441 | // ps.WriteLine(" <IncrementalBuild = \"{0}\"", conf.Options["IncrementalBuild"]); |
@@ -458,7 +462,7 @@ namespace Prebuild.Core.Targets | |||
458 | // Assembly References | 462 | // Assembly References |
459 | ps.WriteLine(" <ItemGroup>"); | 463 | ps.WriteLine(" <ItemGroup>"); |
460 | string refPath = ((ReferencePathNode) project.ReferencePaths[0]).Path; | 464 | string refPath = ((ReferencePathNode) project.ReferencePaths[0]).Path; |
461 | 465 | ||
462 | foreach (ReferenceNode refr in project.References) | 466 | foreach (ReferenceNode refr in project.References) |
463 | { | 467 | { |
464 | if (!solution.ProjectsTable.ContainsKey(refr.Name)) | 468 | if (!solution.ProjectsTable.ContainsKey(refr.Name)) |
@@ -471,7 +475,7 @@ namespace Prebuild.Core.Targets | |||
471 | 475 | ||
472 | string path; | 476 | string path; |
473 | 477 | ||
474 | if( refr.Name.EndsWith(".dll", StringComparison.InvariantCultureIgnoreCase )) | 478 | if (refr.Name.EndsWith(".dll", StringComparison.InvariantCultureIgnoreCase)) |
475 | { | 479 | { |
476 | path = Helper.NormalizePath(Path.Combine( refPath, refr.Name), '\\'); | 480 | path = Helper.NormalizePath(Path.Combine( refPath, refr.Name), '\\'); |
477 | } | 481 | } |
@@ -479,7 +483,7 @@ namespace Prebuild.Core.Targets | |||
479 | { | 483 | { |
480 | path = refr.Name + ".dll"; | 484 | path = refr.Name + ".dll"; |
481 | } | 485 | } |
482 | 486 | ||
483 | // TODO: Allow reference to *.exe files | 487 | // TODO: Allow reference to *.exe files |
484 | ps.WriteLine(" <HintPath>{0}</HintPath>", path ); | 488 | ps.WriteLine(" <HintPath>{0}</HintPath>", path ); |
485 | ps.WriteLine(" <Private>{0}</Private>", refr.LocalCopy); | 489 | ps.WriteLine(" <Private>{0}</Private>", refr.LocalCopy); |
@@ -602,35 +606,53 @@ namespace Prebuild.Core.Targets | |||
602 | { | 606 | { |
603 | if (!list.Contains(file)) | 607 | if (!list.Contains(file)) |
604 | { | 608 | { |
605 | ps.Write(" <{0} ", project.Files.GetBuildAction(file)); | 609 | ps.Write(" <{0} ", project.Files.GetBuildAction(file)); |
606 | ps.WriteLine("Include=\"{0}\">", file); | ||
607 | 610 | ||
611 | int startPos = 0; | ||
612 | if ( project.Files.GetPreservePath( file ) ) | ||
613 | { | ||
614 | while ( ( @"./\" ).IndexOf( file.Substring( startPos, 1 ) ) != -1 ) | ||
615 | startPos++; | ||
608 | 616 | ||
609 | if (file.Contains("Designer.cs")) | 617 | } |
610 | { | 618 | else |
611 | ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", file.Substring(0, file.IndexOf(".Designer.cs")) + ".cs"); | 619 | { |
612 | } | 620 | startPos = file.LastIndexOf( Path.GetFileName( file ) ); |
621 | } | ||
622 | ps.WriteLine("Include=\"{0}\">", Helper.NormalizePath(file)); | ||
613 | 623 | ||
614 | if (project.Files.GetIsLink(file)) | 624 | |
615 | { | 625 | if (file.Contains("Designer.cs")) |
616 | ps.WriteLine(" <Link>{0}</Link>", Path.GetFileName(file)); | 626 | { |
617 | } | 627 | string d = ".Designer.cs"; |
618 | else if (project.Files.GetBuildAction(file) != BuildAction.None) | 628 | int index = file.Contains("\\") ? file.IndexOf("\\") + 1 : 0; |
619 | { | 629 | ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", file.Substring(index, file.Length - index - d.Length) + ".cs"); |
620 | if (project.Files.GetBuildAction(file) != BuildAction.EmbeddedResource) | 630 | } |
621 | { | 631 | |
622 | ps.WriteLine(" <SubType>{0}</SubType>", project.Files.GetSubType(file)); | 632 | if (project.Files.GetIsLink(file)) |
623 | } | 633 | { |
624 | } | 634 | string alias = project.Files.GetLinkPath( file ); |
625 | if (project.Files.GetCopyToOutput(file) != CopyToOutput.Never) | 635 | alias += file.Substring( startPos ); |
636 | alias = Helper.NormalizePath( alias ); | ||
637 | ps.WriteLine( " <Link>{0}</Link>", alias ); | ||
638 | } | ||
639 | else if (project.Files.GetBuildAction(file) != BuildAction.None) | ||
640 | { | ||
641 | if (project.Files.GetBuildAction(file) != BuildAction.EmbeddedResource) | ||
626 | { | 642 | { |
627 | ps.WriteLine(" <CopyToOutputDirectory>{0}</CopyToOutputDirectory>", project.Files.GetCopyToOutput(file)); | 643 | ps.WriteLine(" <SubType>{0}</SubType>", project.Files.GetSubType(file)); |
628 | } | 644 | } |
645 | } | ||
629 | 646 | ||
630 | ps.WriteLine(" </{0}>", project.Files.GetBuildAction(file)); | 647 | if (project.Files.GetCopyToOutput(file) != CopyToOutput.Never) |
648 | { | ||
649 | ps.WriteLine(" <CopyToOutputDirectory>{0}</CopyToOutputDirectory>", project.Files.GetCopyToOutput(file)); | ||
631 | } | 650 | } |
651 | |||
652 | ps.WriteLine(" </{0}>", project.Files.GetBuildAction(file)); | ||
632 | } | 653 | } |
633 | } | 654 | } |
655 | } | ||
634 | // ps.WriteLine(" </Include>"); | 656 | // ps.WriteLine(" </Include>"); |
635 | 657 | ||
636 | ps.WriteLine(" </ItemGroup>"); | 658 | ps.WriteLine(" </ItemGroup>"); |
@@ -658,15 +680,14 @@ namespace Prebuild.Core.Targets | |||
658 | ps.WriteLine(" <PropertyGroup>"); | 680 | ps.WriteLine(" <PropertyGroup>"); |
659 | //ps.WriteLine(" <Settings ReferencePath=\"{0}\">", MakeRefPath(project)); | 681 | //ps.WriteLine(" <Settings ReferencePath=\"{0}\">", MakeRefPath(project)); |
660 | 682 | ||
661 | |||
662 | ps.WriteLine(" <Configuration Condition=\" '$(Configuration)' == '' \">Debug</Configuration>"); | 683 | ps.WriteLine(" <Configuration Condition=\" '$(Configuration)' == '' \">Debug</Configuration>"); |
663 | ps.WriteLine(" <Platform Condition=\" '$(Platform)' == '' \">AnyCPU</Platform>"); | ||
664 | 684 | ||
665 | if (projectFile.Contains( "OpenSim.csproj" )) | 685 | if (projectFile.Contains( "OpenSim.csproj" )) |
666 | { | 686 | { |
667 | ps.WriteLine(" <StartArguments>-loginserver -sandbox -accounts</StartArguments>"); | 687 | ps.WriteLine(" <StartArguments>-loginserver -sandbox -accounts</StartArguments>"); |
668 | } | 688 | } |
669 | 689 | ||
690 | ps.WriteLine(" <Platform Condition=\" '$(Platform)' == '' \">AnyCPU</Platform>"); | ||
670 | ps.WriteLine(" <ReferencePath>{0}</ReferencePath>", MakeRefPath(project)); | 691 | ps.WriteLine(" <ReferencePath>{0}</ReferencePath>", MakeRefPath(project)); |
671 | ps.WriteLine(" <LastOpenVersion>{0}</LastOpenVersion>", this.ProductVersion); | 692 | ps.WriteLine(" <LastOpenVersion>{0}</LastOpenVersion>", this.ProductVersion); |
672 | ps.WriteLine(" <ProjectView>ProjectFiles</ProjectView>"); | 693 | ps.WriteLine(" <ProjectView>ProjectFiles</ProjectView>"); |
@@ -678,7 +699,7 @@ namespace Prebuild.Core.Targets | |||
678 | ps.Write(" Condition = \" '$(Configuration)|$(Platform)' == '{0}|AnyCPU' \"", conf.Name); | 699 | ps.Write(" Condition = \" '$(Configuration)|$(Platform)' == '{0}|AnyCPU' \"", conf.Name); |
679 | ps.WriteLine(" />"); | 700 | ps.WriteLine(" />"); |
680 | } | 701 | } |
681 | 702 | ||
682 | ps.WriteLine("</Project>"); | 703 | ps.WriteLine("</Project>"); |
683 | } | 704 | } |
684 | #endregion | 705 | #endregion |