Prebuild:

* Don't add duplicate assembly references
* Create a HintPath for assembly references that exist in a project reference directory (fixes an xbuild issue)
* Add a VS2010 target

git-svn-id: http://libopenmetaverse.googlecode.com/svn/libopenmetaverse/trunk@3075 52acb1d6-8a22-11de-b505-999d5b087335
This commit is contained in:
John Hurliman
2009-08-12 04:46:44 +00:00
parent 3419ce6353
commit 85a2f183f4
6 changed files with 216 additions and 7 deletions

View File

@@ -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
{
/// <summary>
///
/// </summary>
[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;
/// <summary>
/// Gets or sets the solution version.
/// </summary>
/// <value>The solution version.</value>
public override string SolutionVersion
{
get
{
return solutionVersion;
}
}
/// <summary>
/// Gets or sets the product version.
/// </summary>
/// <value>The product version.</value>
public override string ProductVersion
{
get
{
return productVersion;
}
}
/// <summary>
/// Gets or sets the schema version.
/// </summary>
/// <value>The schema version.</value>
public override string SchemaVersion
{
get
{
return schemaVersion;
}
}
/// <summary>
/// Gets or sets the name of the version.
/// </summary>
/// <value>The name of the version.</value>
public override string VersionName
{
get
{
return versionName;
}
}
/// <summary>
/// Gets or sets the version.
/// </summary>
/// <value>The version.</value>
public override VSVersion Version
{
get
{
return version;
}
}
/// <summary>
/// Gets the name.
/// </summary>
/// <value>The name.</value>
public override string Name
{
get
{
return name;
}
}
#endregion
#region Constructors
/// <summary>
/// Initializes a new instance of the <see cref="VS2010Target"/> class.
/// </summary>
public VS2010Target()
: base()
{
}
#endregion
}
}

View File

@@ -207,7 +207,7 @@ namespace Prebuild.Core.Targets
#region Project File
using (ps)
{
ps.WriteLine("<Project DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\" ToolsVersion=\"3.5\">");
ps.WriteLine("<Project DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\" ToolsVersion=\"{0}\">", this.Version == VSVersion.VS10 ? "4.0" : "3.5");
ps.WriteLine(" <PropertyGroup>");
ps.WriteLine(" <ProjectType>Local</ProjectType>");
ps.WriteLine(" <ProductVersion>{0}</ProductVersion>", 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("</Name>");
// TODO: Allow reference to *.exe files
if (!String.IsNullOrEmpty(refr.Path))
ps.WriteLine(" <HintPath>{0}</HintPath>", Helper.MakePathRelativeTo(project.FullPath, refr.Path + "\\" + refr.Name + ".dll"));
if (!String.IsNullOrEmpty(refr.Path))
{
ps.WriteLine(" <HintPath>{0}</HintPath>", 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(" <HintPath>{0}</HintPath>", fullRefPath + refr.Name + ".dll");
break;
}
else if (File.Exists(fullRefPath + refr.Name + ".exe"))
{
ps.WriteLine(" <HintPath>{0}</HintPath>", fullRefPath + refr.Name + ".exe");
break;
}
}
catch (Exception)
{ }
}
}
ps.WriteLine(" </Reference>");
}
ps.WriteLine(" </ItemGroup>");
@@ -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);

View File

@@ -54,6 +54,10 @@ namespace Prebuild.Core.Targets
/// <summary>
/// Visual Studio 2008
/// </summary>
VS90
VS90,
/// <summary>
/// Visual Studio 2010
/// </summary>
VS10
}
}