diff --git a/Programs/Prebuild/src/Core/Targets/VS2010Target.cs b/Programs/Prebuild/src/Core/Targets/VS2010Target.cs new file mode 100644 index 00000000..93939824 --- /dev/null +++ b/Programs/Prebuild/src/Core/Targets/VS2010Target.cs @@ -0,0 +1,113 @@ +using System; +using System.Collections; +using System.Collections.Specialized; +using System.IO; +using System.Text; + +using Prebuild.Core.Attributes; +using Prebuild.Core.Interfaces; +using Prebuild.Core.Nodes; +using Prebuild.Core.Utilities; +using System.CodeDom.Compiler; + +namespace Prebuild.Core.Targets +{ + + /// + /// + /// + [Target("vs2010")] + public class VS2010Target : VSGenericTarget + { + #region Fields + string solutionVersion = "11.00"; + string productVersion = "10.0.20506"; + string schemaVersion = "2.0"; + string versionName = "Visual Studio 2010"; + string name = "vs2010"; + VSVersion version = VSVersion.VS10; + + Hashtable tools; + Kernel kernel; + + /// + /// Gets or sets the solution version. + /// + /// The solution version. + public override string SolutionVersion + { + get + { + return solutionVersion; + } + } + /// + /// Gets or sets the product version. + /// + /// The product version. + public override string ProductVersion + { + get + { + return productVersion; + } + } + /// + /// Gets or sets the schema version. + /// + /// The schema version. + public override string SchemaVersion + { + get + { + return schemaVersion; + } + } + /// + /// Gets or sets the name of the version. + /// + /// The name of the version. + public override string VersionName + { + get + { + return versionName; + } + } + /// + /// Gets or sets the version. + /// + /// The version. + public override VSVersion Version + { + get + { + return version; + } + } + /// + /// Gets the name. + /// + /// The name. + public override string Name + { + get + { + return name; + } + } + #endregion + + #region Constructors + + /// + /// Initializes a new instance of the class. + /// + public VS2010Target() + : base() + { + } + + #endregion + } +} diff --git a/Programs/Prebuild/src/Core/Targets/VSGenericTarget.cs b/Programs/Prebuild/src/Core/Targets/VSGenericTarget.cs index d1251195..aaae9d18 100644 --- a/Programs/Prebuild/src/Core/Targets/VSGenericTarget.cs +++ b/Programs/Prebuild/src/Core/Targets/VSGenericTarget.cs @@ -207,7 +207,7 @@ namespace Prebuild.Core.Targets #region Project File using (ps) { - ps.WriteLine(""); + ps.WriteLine("", this.Version == VSVersion.VS10 ? "4.0" : "3.5"); ps.WriteLine(" "); ps.WriteLine(" Local"); ps.WriteLine(" {0}", this.ProductVersion); @@ -292,7 +292,8 @@ namespace Prebuild.Core.Targets if (projectNode == null) { - otherReferences.Add(refr); + if (!otherReferences.Contains(refr)) + otherReferences.Add(refr); } else { @@ -313,8 +314,32 @@ namespace Prebuild.Core.Targets ps.WriteLine(""); // TODO: Allow reference to *.exe files - if (!String.IsNullOrEmpty(refr.Path)) - ps.WriteLine(" {0}", Helper.MakePathRelativeTo(project.FullPath, refr.Path + "\\" + refr.Name + ".dll")); + if (!String.IsNullOrEmpty(refr.Path)) + { + ps.WriteLine(" {0}", Helper.MakePathRelativeTo(project.FullPath, refr.Path + "\\" + refr.Name + ".dll")); + } + else + { + foreach (ReferencePathNode node in project.ReferencePaths) + { + try + { + string fullRefPath = Helper.ResolvePath(node.Path); + if (File.Exists(fullRefPath + refr.Name + ".dll")) + { + ps.WriteLine(" {0}", fullRefPath + refr.Name + ".dll"); + break; + } + else if (File.Exists(fullRefPath + refr.Name + ".exe")) + { + ps.WriteLine(" {0}", fullRefPath + refr.Name + ".exe"); + break; + } + } + catch (Exception) + { } + } + } ps.WriteLine(" "); } ps.WriteLine(" "); @@ -616,6 +641,9 @@ namespace Prebuild.Core.Targets case VSVersion.VS90: ss.WriteLine("# Visual Studio 2008"); break; + case VSVersion.VS10: + ss.WriteLine("# Visual Studio 10"); + break; } WriteProjectDeclarations(ss, solution, solution); diff --git a/Programs/Prebuild/src/Core/Targets/VSVersion.cs b/Programs/Prebuild/src/Core/Targets/VSVersion.cs index 6785e851..ed709900 100644 --- a/Programs/Prebuild/src/Core/Targets/VSVersion.cs +++ b/Programs/Prebuild/src/Core/Targets/VSVersion.cs @@ -54,6 +54,10 @@ namespace Prebuild.Core.Targets /// /// Visual Studio 2008 /// - VS90 + VS90, + /// + /// Visual Studio 2010 + /// + VS10 } } diff --git a/bin/Prebuild.exe b/bin/Prebuild.exe index a5f21893..5dac2b51 100644 Binary files a/bin/Prebuild.exe and b/bin/Prebuild.exe differ diff --git a/runprebuild2008.bat b/runprebuild2008.bat index b9443d76..f1328d22 100644 --- a/runprebuild2008.bat +++ b/runprebuild2008.bat @@ -15,12 +15,11 @@ :: echo ########################################## -echo creating prebuild files for: nant, vs2008 +echo creating prebuild files for: vs2008 echo Parameters: %1 %2 echo ########################################## :: run prebuild to generate solution/project files from prebuild.xml configuration file -bin\Prebuild.exe /target nant bin\Prebuild.exe /target vs2008 :: build compile.bat file based on command line parameters diff --git a/runprebuild2010.bat b/runprebuild2010.bat new file mode 100644 index 00000000..bfa32e6c --- /dev/null +++ b/runprebuild2010.bat @@ -0,0 +1,65 @@ +@echo off +:: +:: Prebuild generator for the OpenMetaverse Library +:: +:: Command Line Options: +:: (none) - create solution/project files and create compile.bat file to build solution +:: msbuild - Create project files, compile solution +:: msbuild runtests - create project files, compile solution, run unit tests +:: msbuild docs - create project files, compile solution, build API documentation +:: msbuild docs dist - Create project files, compile solution, run unit tests, build api documentation, create binary zip +:: - and exe installer +:: +:: nant - Create project files, run nant to compile solution +:: nant runtests - Create project files, run nant to compile solution, run unit tests +:: + +echo ########################################## +echo creating prebuild files for: vs2010 +echo Parameters: %1 %2 +echo ########################################## + +:: run prebuild to generate solution/project files from prebuild.xml configuration file +bin\Prebuild.exe /target vs2010 + +:: build compile.bat file based on command line parameters +echo @echo off > compile.bat +if(.%1)==(.) echo C:\WINDOWS\Microsoft.NET\Framework\v3.5\msbuild OpenMetaverse.sln >> compile.bat + +if(.%1)==(.msbuild) echo echo ==== COMPILE BEGIN ==== >> compile.bat +if(.%1)==(.msbuild) echo %SystemRoot%\Microsoft.NET\Framework\v3.5\MSBuild.exe /p:Configuration=Release OpenMetaverse.sln >> compile.bat +if(.%1)==(.msbuild) echo IF ERRORLEVEL 1 GOTO FAIL >> compile.bat + +if(.%1)==(.nant) echo nant >> compile.bat +if(.%1)==(.nant) echo IF ERRORLEVEL 1 GOTO FAIL >> compile.bat + +if(.%3)==(.docs) echo echo ==== GENERATE DOCUMENTATION BEGIN ==== >> compile.bat +if(.%2)==(.docs) echo %SystemRoot%\Microsoft.NET\Framework\v3.5\MSBuild.exe /p:Configuration=Release docs\OpenMetaverse.shfbproj >> compile.bat +if(.%2)==(.docs) echo IF ERRORLEVEL 1 GOTO FAIL >> compile.bat +if(.%2)==(.docs) echo 7z.exe a -tzip docs\documentation.zip docs\trunk >> compile.bat +if(.%2)==(.docs) echo IF ERRORLEVEL 1 GOTO FAIL >> compile.bat + +if(.%2)==(.runtests) echo echo ==== UNIT TESTS BEGIN ==== >> compile.bat +if(.%2)==(.runtests) echo nunit-console bin\OpenMetaverse.Tests.dll /exclude:Network /nodots /labels /xml:testresults.xml >> compile.bat + +if(.%2)==(.runtests) echo IF ERRORLEVEL 1 GOTO FAIL >> compile.bat + +:: nsis compiler needs to be in path +if(.%3)==(.dist) echo echo ==== GENERATE DISTRIBUTION BEGIN ==== >> compile.bat +if(.%3)==(.dist) echo makensis.exe /DPlatform=test docs\OpenMetaverse-installer.nsi >> compile.bat +if(.%3)==(.dist) echo IF ERRORLEVEL 1 GOTO FAIL >> compile.bat +if(.%3)==(.dist) echo 7z.exe a -tzip dist\openmetaverse-dist.zip @docs\distfiles.lst >> compile.bat +if(.%3)==(.dist) echo IF ERRORLEVEL 1 GOTO FAIL >> compile.bat + +echo :SUCCESS >> compile.bat +echo echo Build Successful! >> compile.bat +echo exit /B 0 >> compile.bat +echo :FAIL >> compile.bat +echo echo Build Failed, check log for reason >> compile.bat +echo exit /B 1 >> compile.bat + +:: perform the appropriate action +if(.%1)==(.msbuild) compile.bat +if(.%1)==(.nant) compile.bat +if(.%1)==(.dist) compile.bat +