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:
113
Programs/Prebuild/src/Core/Targets/VS2010Target.cs
Normal file
113
Programs/Prebuild/src/Core/Targets/VS2010Target.cs
Normal 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
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
|
||||
@@ -54,6 +54,10 @@ namespace Prebuild.Core.Targets
|
||||
/// <summary>
|
||||
/// Visual Studio 2008
|
||||
/// </summary>
|
||||
VS90
|
||||
VS90,
|
||||
/// <summary>
|
||||
/// Visual Studio 2010
|
||||
/// </summary>
|
||||
VS10
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user