Re: Back to atlassian code review?
Ryan Boggs <[email protected]> Fri, 27 May 2011 07:01:51 -0700
| Newsgroups | gmane.comp.windows.dotnet.nant.devel |
|---|---|
| Message-ID | <[email protected]> |
Well... It sounds like there are still issues with people accessing this system so I have attached the diffs for a manual review for the time being. Please reply to this thread if there are any questions with the attached diffs. Thanks, Ryan On Wed, May 25, 2011 at 8:29 PM, Ryan Boggs <[email protected]> wrote: > Finally uploaded the diffs into the review. Link is below. I > assigned both you and Gert as reviewers. > > https://fisheye1.atlassian.com/cru/CR-62 > > FYI - It took me a bit to get in earlier today. Dunno if they had > some technical issues or what but I wanted to get you a heads up. > > Thanks, > Ryan > > On Wed, May 25, 2011 at 3:33 PM, Ryan Boggs <[email protected]> wrote: >> Ok, I'll do it tonight and post the link once the diffs are posted. Please let me know if you have questions/issues with the system. >> >> Thanks, >> Ryan >> >> On May 25, 2011, at 12:18 PM, Dominik Guder <[email protected]> wrote: >> >>> Hi Ryan, >>> >>> yes of course go ahead. I might try to put my "CreateInstance" proposal to fisheye too. >>> >>> So far Dominik >>> >>> Am 25.05.2011 02:52, schrieb Ryan Boggs: >>>> Hi, >>>> >>>> Any thoughts on this? I have a handful of diffs from Martin Aliger >>>> that I would like you guys to review soon. >>>> >>>> Thanks, >>>> Ryan >>>> >>>> On Sun, May 22, 2011 at 1:38 PM, Ryan Boggs<[email protected]> wrote: >>>>> Hi, >>>>> >>>>> Since we are a group of more than 2, should we consider going back to >>>>> using the atlassian code review that Charles setup awhile ago? I know >>>>> Gert had issues with it in the past but I do still see value to having >>>>> something like this. Thoughts? >>>>> >>>>> https://fisheye1.atlassian.com/ >>> >>> -- >>> The answer to the great question of life, >>> the universe and everything is 42 (Douglas Adams) >> > ------------------------------------------------------------------------------ vRanger cuts backup time in half-while increasing security. With the market-leading solution for virtual backup and recovery, you get blazing-fast, flexible, and affordable data protection. Download your free trial now. http://p.sf.net/sfu/quest-d2dcopy1 _______________________________________________ nant-developers mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/nant-developers
MSBuildUpdates.diff
(application/octet-stream, 68.1 KB)
Index: src/NAnt.MSBuild/MSBuildAssemblyReference.cs
===================================================================
RCS file: /cvsroot/nant/nant/src/NAnt.MSBuild/MSBuildAssemblyReference.cs,v
retrieving revision 1.1
diff -u -r1.1 MSBuildAssemblyReference.cs
--- src/NAnt.MSBuild/MSBuildAssemblyReference.cs 22 Dec 2006 17:30:21 -0000 1.1
+++ src/NAnt.MSBuild/MSBuildAssemblyReference.cs 23 May 2011 00:36:30 -0000
@@ -37,13 +37,16 @@
private readonly string _assemblyFile;
private readonly string _hintpath;
- public MSBuildAssemblyReference(XmlElement xe, ReferencesResolver referencesResolver, ProjectBase parent, GacCache gacCache, string name, string priv, string hintpath)
+ public MSBuildAssemblyReference(XmlElement xe, ReferencesResolver referencesResolver, ProjectBase parent, GacCache gacCache, string name, string priv, string hintpath, string extension)
: base(new DummyXmlElement(xe.OwnerDocument), referencesResolver, parent, gacCache) {
+ if (extension == null || extension.Length == 0) {
+ extension = ".dll";
+ }
if (name.Contains(",")) {
//fully specified reference. Hmmm - just ignore it for now.
name = name.Split(',')[0];
- if (hintpath.Length == 0) //hintpath workaround
- hintpath = "." + Path.DirectorySeparatorChar + name + ".dll";
+ //if (hintpath.Length == 0) //hintpath workaround
+ // hintpath = "." + Path.DirectorySeparatorChar + name + extension; // ".dll";
}
_name = name;
_helper = new MSBuildReferenceHelper(priv, false);
@@ -98,6 +101,13 @@
return resolvedAssemblyFile;
}
+ // resolve from outputPath
+ if (Parent is MSBuildProject) {
+ resolvedAssemblyFile = ResolveFromRelativePath(Path.Combine(((MSBuildProject)Parent).OutputPath, assemblyFileName));
+ if (resolvedAssemblyFile != null) {
+ return resolvedAssemblyFile;
+ }
+ }
// assembly reference could not be resolved
return null;
}
Index: src/NAnt.MSBuild/MSBuildConfiguration.cs
===================================================================
RCS file: /cvsroot/nant/nant/src/NAnt.MSBuild/MSBuildConfiguration.cs,v
retrieving revision 1.3
diff -u -r1.3 MSBuildConfiguration.cs
--- src/NAnt.MSBuild/MSBuildConfiguration.cs 30 Apr 2008 15:46:00 -0000 1.3
+++ src/NAnt.MSBuild/MSBuildConfiguration.cs 23 May 2011 00:36:30 -0000
@@ -43,10 +43,12 @@
public MSBuildConfiguration(MSBuildProject project, Microsoft.Build.BuildEngine.Project msproj, Configuration projectConfig)
: base(project) {
_name = projectConfig.Name;
+ _platform = projectConfig.Platform;
+ //explicit set. EvaluatedProperties will use those.
+ //Its caller responsibility to set it back to original values, if needed
msproj.GlobalProperties.SetProperty("Configuration", _name);
- project.SetPlatform (projectConfig.Platform);
- _platform = msproj.GetEvaluatedProperty("Platform");
+ msproj.GlobalProperties.SetProperty("Platform", _platform.Replace(" ", string.Empty));
_relativeOutputDir = msproj.GetEvaluatedProperty("OutputPath");
if (!_relativeOutputDir.EndsWith(Path.DirectorySeparatorChar.ToString(CultureInfo.InvariantCulture))) {
Index: src/NAnt.MSBuild/MSBuildEngine.cs
===================================================================
RCS file: /cvsroot/nant/nant/src/NAnt.MSBuild/MSBuildEngine.cs,v
retrieving revision 1.3
diff -u -r1.3 MSBuildEngine.cs
--- src/NAnt.MSBuild/MSBuildEngine.cs 6 Jan 2007 20:14:12 -0000 1.3
+++ src/NAnt.MSBuild/MSBuildEngine.cs 23 May 2011 00:36:30 -0000
@@ -20,7 +20,7 @@
using System;
using System.Text;
-using Microsoft.Build.Utilities;
+//using Microsoft.Build.Utilities;
using NAnt.Core;
using NAnt.Core.Tasks;
@@ -35,48 +35,46 @@
}
// map current target framework to TargetDotNetFrameworkVersion
- TargetDotNetFrameworkVersion frameworkVersion = GetTargetDotNetFrameworkVersion(
- solutionTask.Project.TargetFramework);
+ //TargetDotNetFrameworkVersion frameworkVersion = GetTargetDotNetFrameworkVersion(
+ //solutionTask.Project.TargetFramework);
// use the framework directory as BinPath
- string frameworkDir = ToolLocationHelper.GetPathToDotNetFramework(
- frameworkVersion);
+ //string frameworkDir = solutionTask.Project.TargetFramework.FrameworkDirectory;
+ //ToolLocationHelper.GetPathToDotNetFramework( frameworkVersion);
- _msbuild = new Microsoft.Build.BuildEngine.Engine(frameworkDir);
+ try {
+ _msbuild = Microsoft.Build.BuildEngine.Engine.LoadEngine(solutionTask.Project.TargetFramework);
+ //new Microsoft.Build.BuildEngine.Engine(solutionTask.Project.TargetFramework);
+ } catch (Exception e) {
+ throw new BuildException(
+ String.Format(
+ "MSBuild v{0} can't be found. It is needed for building MSBuild projects. VS2005 and later is using MSBuild projects for C# and VB",
+ solutionTask.Project.TargetFramework.Version),
+ Location.UnknownLocation, e);
+ }
_msbuild.UnregisterAllLoggers();
- _msbuild.RegisterLogger(
- new NAntLogger(solutionTask,
- solutionTask.Verbose ? Microsoft.Build.Framework.LoggerVerbosity.Normal : Microsoft.Build.Framework.LoggerVerbosity.Minimal
- )
- );
-
- /*
- foreach (PropertyTask property in solutionTask.CustomProperties) {
- string val;
- // expand properties in context of current project for non-dynamic properties
- if (!property.Dynamic) {
- val = solutionTask.Project.ExpandProperties(property.Value, solutionTask.Location);
- }
- else
- val = property.Value;
- _msbuild.GlobalProperties.SetProperty(property.PropertyName, val);
+ NAntLoggerVerbosity _verbosity = solutionTask.Verbose ? NAntLoggerVerbosity.Normal : NAntLoggerVerbosity.Minimal;
+ NAntLogger _logger = NAntLogger.Create(solutionTask.Project.TargetFramework, solutionTask, _verbosity, _msbuild);
+ if (_logger != null) {
+ _msbuild.RegisterLogger(_logger);
}
- */
+
+ solutionTask.Log(Level.Info, "Using MSBuild version {0}.", _msbuild.Assembly.GetName().Version);
return _msbuild;
}
- private static TargetDotNetFrameworkVersion GetTargetDotNetFrameworkVersion (FrameworkInfo framework) {
- switch (framework.ClrVersion.ToString (2)) {
- case "1.1":
- return TargetDotNetFrameworkVersion.Version11;
- case "2.0":
- return TargetDotNetFrameworkVersion.Version20;
- default:
- throw new BuildException ("Current target framework is not supported.",
- Location.UnknownLocation);
- }
- }
+ //private static TargetDotNetFrameworkVersion GetTargetDotNetFrameworkVersion (FrameworkInfo framework) {
+ // switch (framework.ClrVersion.ToString (2)) {
+ // case "1.1":
+ // return TargetDotNetFrameworkVersion.Version11;
+ // case "2.0":
+ // return TargetDotNetFrameworkVersion.Version20;
+ // default:
+ // throw new BuildException ("Current target framework is not supported.",
+ // Location.UnknownLocation);
+ // }
+ //}
}
}
Index: src/NAnt.MSBuild/MSBuildProject.cs
===================================================================
RCS file: /cvsroot/nant/nant/src/NAnt.MSBuild/MSBuildProject.cs,v
retrieving revision 1.4
diff -u -r1.4 MSBuildProject.cs
--- src/NAnt.MSBuild/MSBuildProject.cs 30 Apr 2008 15:46:00 -0000 1.4
+++ src/NAnt.MSBuild/MSBuildProject.cs 23 May 2011 00:36:31 -0000
@@ -18,13 +18,13 @@
// Martin Aliger ([email protected])
using System;
+using System.Xml;
using System.CodeDom.Compiler;
using System.Collections;
using System.Collections.Specialized;
using System.Globalization;
using System.IO;
using System.Text;
-using System.Xml;
using NAnt.Core;
using NAnt.Core.Util;
@@ -82,19 +82,59 @@
_msproj = new Microsoft.Build.BuildEngine.Project(_msbuild);
_msproj.FullFileName = projectPath;
_msproj.LoadXml(xmlDefinition.OuterXml);
+
_msproj.GlobalProperties.SetProperty("Configuration", cfgname);
- SetPlatform (platform);
+ if (platform.Length > 0) _msproj.GlobalProperties.SetProperty("Platform", platform.Replace(" ", string.Empty));
if (outputDir != null) _msproj.GlobalProperties.SetProperty("OutputPath", outputDir.FullName);
+ //bool targwarnings = true;
+ foreach (NAnt.Core.Tasks.PropertyTask property in solutionTask.CustomProperties) {
+ string val;
+ // expand properties in context of current project for non-dynamic properties
+ if (!property.Dynamic) {
+ val = solutionTask.Project.ExpandProperties(property.Value, solutionTask.Location);
+ } else {
+ val = property.Value;
+ }
+ _msproj.GlobalProperties.SetProperty(property.PropertyName, val);
+ //if (property.PropertyName == "TargetWarnings") targwarnings = Boolean.Parse(val);
+ }
+
+
+ //set tools version to the msbuild version we got loaded
+ _msproj.ToolsVersion = SolutionTask.Project.TargetFramework.Version.ToString();
+
+ //TODO: honoring project's TargetFrameworkVersion is not working atm. System assemblies are resolved badly
+ _msproj.GlobalProperties.SetProperty("TargetFrameworkVersion", "v" + SolutionTask.Project.TargetFramework.Version.ToString());
+
//evaluating
_guid = _msproj.GetEvaluatedProperty("ProjectGuid");
_projectDirectory = new DirectoryInfo(_msproj.GetEvaluatedProperty("ProjectDir"));
_projectPath = _msproj.GetEvaluatedProperty("ProjectPath");
+ //TODO: honoring project's TargetFrameworkVersion is not working atm. System assemblies are resolved badly
+ ////check if we targeting something else and throw a warning
+ //if (targwarnings)
+ //{
+ // string verString = _msproj.GetEvaluatedProperty("TargetFrameworkVersion");
+ // if (verString != null)
+ // {
+ // if (verString.StartsWith("v")) verString = verString.Substring(1);
+ // Version ver = new Version(verString);
+ // if (!ver.Equals(SolutionTask.Project.TargetFramework.Version))
+ // {
+ // Log(Level.Warning, "Project '{1}' targets framework {0}.", verString, Name);
+ // }
+ // }
+ //}
+
+ //project configuration
ProjectEntry projectEntry = solution.ProjectEntries [_guid];
if (projectEntry != null && projectEntry.BuildConfigurations != null) {
foreach (ConfigurationMapEntry ce in projectEntry.BuildConfigurations) {
+ Configuration solutionConfig = ce.Key;
Configuration projectConfig = ce.Value;
+
ProjectConfigurations[projectConfig] = new MSBuildConfiguration(this, _msproj, projectConfig);
}
} else {
@@ -109,10 +149,11 @@
string rpath = r.FinalItemSpec;
string priv = r.GetMetadata("Private");
string hintpath = r.GetMetadata("HintPath");
+ string ext = r.GetMetadata("ExecutableExtension");
ReferenceBase reference = new MSBuildAssemblyReference(
xmlDefinition, ReferencesResolver, this, gacCache,
- rpath, priv, hintpath);
+ rpath, priv, hintpath, ext);
_references.Add(reference);
}
refs = _msproj.GetEvaluatedItemsByName("ProjectReference");
@@ -128,6 +169,10 @@
}
}
+ internal string OutputPath {
+ get { return this.OutputDir.FullName; }
+ }
+
public override string Name {
get {
string projectPath;
@@ -139,8 +184,7 @@
// get last segment of the uri (which should be the
// project file itself)
projectPath = projectUri.LocalPath;
- }
- else {
+ } else {
projectPath = ProjectPath;
}
@@ -157,8 +201,7 @@
get {
if (IsUrl(_projectPath)) {
return _projectPath;
- }
- else {
+ } else {
return FileUtils.GetFullPath(_projectPath);
}
}
@@ -177,10 +220,8 @@
set { throw new InvalidOperationException("It is not allowed to change the GUID of a MSBuild project"); }
}
- public override ArrayList References {
- get {
- return _references;
- }
+ public override System.Collections.ArrayList References {
+ get { return _references; }
}
public override ProjectReferenceBase CreateProjectReference(ProjectBase project, bool isPrivateSpecified, bool isPrivate) {
@@ -192,43 +233,58 @@
}
protected override ProductVersion DetermineProductVersion(System.Xml.XmlElement docElement) {
- return ProductVersion.Whidbey;
+
+ XmlNamespaceManager _nsMgr = new XmlNamespaceManager(new NameTable());
+ _nsMgr.AddNamespace("ms", docElement.NamespaceURI);
+ XmlNode _verNode = docElement.SelectSingleNode("ms:PropertyGroup/ms:ProductVersion", _nsMgr);
+
+ if(_verNode==null) {
+ return ProductVersion.Whidbey;
+ }
+ Version _ver = new Version(_verNode.InnerText);
+
+ switch (_ver.Major) {
+ case 8:
+ // <ProductVersion>8.0.50727</ProductVersion>
+ return ProductVersion.Whidbey;
+ case 9:
+ if (_ver.Build <= 21022)
+ // <ProductVersion>9.0.21022</ProductVersion>
+ return ProductVersion.Orcas;
+ return ProductVersion.Rosario;
+ default:
+ throw new BuildException(string.Format(CultureInfo.InvariantCulture,
+ "Unknown Project version '{0}'.", ProjectPath),
+ Location.UnknownLocation);
+ }
}
protected override void VerifyProjectXml(System.Xml.XmlElement docElement) {
- if(!IsMSBuildProject(docElement))
+ if(!IsMSBuildProject(docElement)) {
throw new BuildException(string.Format(CultureInfo.InvariantCulture,
"Project '{0}' is not a valid MSBUILD project.", ProjectPath),
Location.UnknownLocation);
+ }
}
protected override BuildResult Build(Configuration solutionConfiguration) {
// explicitly set the Configuration and Platform
MSBuildConfiguration projectConfig = (MSBuildConfiguration) BuildConfigurations[solutionConfiguration];
_msproj.GlobalProperties.SetProperty("Configuration", projectConfig.Name);
- SetPlatform (projectConfig.PlatformName);
-
- // DONE: MSBuild'll resolve all references once again
- // is there any way how to disable it?
- // moreover, they could be resolved to something else!
-
- //We should set:
- //@(ReferencePath)
- //@(ReferenceDependencyPaths)
- //@(NativeReference)
- //@(NativeReferenceFile)
- //maybe @(WebReferenceUrl)
- //maybe @(_ReferenceRelatedPaths)
- //@(ReferenceSatellitePaths)
+ _msproj.GlobalProperties.SetProperty("PlatformTarget", projectConfig.PlatformName.Replace(" ", string.Empty));
- // or maybe modify original references to contain full path to whatever we resolved?
- // that seems reasonable. Try it:
+ //modify original references to contain full path to whatever we resolved
_msproj.RemoveItemsByName("Reference");
_msproj.RemoveItemsByName("ProjectReference");
Microsoft.Build.BuildEngine.BuildItemGroup refs = _msproj.AddNewItemGroup();
foreach (ReferenceBase r in _references) {
string path = r.GetPrimaryOutputFile(solutionConfiguration);
if (path == null || !File.Exists(path)) {
+ if (path == null) {
+ Log(Level.Warning, "Reference \"{0}\" of project {1} failed to be found.", r.Name, this.Name);
+ } else {
+ Log(Level.Warning, "Reference \"{0}\" of project {1} failed to be found (resolved to {2})", r.Name, this.Name, path);
+ }
continue;
}
Microsoft.Build.BuildEngine.BuildItem i = refs.AddNewItem("Reference", r.Name);
@@ -236,22 +292,20 @@
i.SetMetadata("CopyLocal", r.CopyLocal ? "True" : "False");
}
- // this should disable assembly resolution and always use hintpath (which we supply)
- _msproj.GlobalProperties.SetProperty("AssemblySearchPaths", "{HintPathFromItem}");
+ //this should disable assembly resolution and always use hintpath (which we supply)
+ if(_msbuild.Assembly.GetName().Version.Major >= 4) {
+ //MSBuild 4 adds some system references automatically, so adding TargetFrameworkDirectory for those
+ _msproj.GlobalProperties.SetProperty("AssemblySearchPaths", "{HintPathFromItem};{TargetFrameworkDirectory}");
+ } else {
+ _msproj.GlobalProperties.SetProperty("AssemblySearchPaths", "{HintPathFromItem}");
+ }
- if(_msproj.Build())
+ if(_msproj.Build()) {
return BuildResult.Success;
+ }
return BuildResult.Failed;
}
- internal void SetPlatform (string platform) {
- if (platform.Length == 0)
- return;
-
- _msproj.GlobalProperties.SetProperty("Platform",
- platform.Replace(" ", string.Empty));
- }
-
private static bool IsUrl(string fileName) {
if (fileName.StartsWith(Uri.UriSchemeFile) || fileName.StartsWith(Uri.UriSchemeHttp) || fileName.StartsWith(Uri.UriSchemeHttps)) {
return true;
@@ -261,3 +315,4 @@
}
}
}
+
Index: src/NAnt.MSBuild/NAntLogger.cs
===================================================================
RCS file: /cvsroot/nant/nant/src/NAnt.MSBuild/NAntLogger.cs,v
retrieving revision 1.1
diff -u -r1.1 NAntLogger.cs
--- src/NAnt.MSBuild/NAntLogger.cs 22 Dec 2006 17:30:24 -0000 1.1
+++ src/NAnt.MSBuild/NAntLogger.cs 23 May 2011 00:36:31 -0000
@@ -18,20 +18,59 @@
// Martin Aliger ([email protected])
using System;
-
-using Microsoft.Build.Framework;
-
using NAnt.Core;
using NAnt.Core.Util;
+using System.CodeDom;
+using System.CodeDom.Compiler;
+using System.IO;
+using System.Reflection;
namespace NAnt.MSBuild {
- internal class NAntLogger : ILogger {
+
+ public enum NAntLoggerVerbosity { Quiet, Minimal, Normal, Detailed, Diagnostic };
+ //internal interface ILogger { }
+ //internal interface IEventSource { }
+ //internal class BuildErrorEventArgs { }
+ //internal class BuildWarningEventArgs { }
+ //internal class BuildMessageEventArgs { }
+ //internal class TaskStartedEventArgs { }
+ //internal class TaskFinishedEventArgs { }
+
+ public class NAntLogger
+ {
+ internal static NAntLogger Create(NAnt.Core.FrameworkInfo framework, Task task, NAntLoggerVerbosity verbosity, Microsoft.Build.BuildEngine.Engine engine)
+ {
+ CodeDomProvider codeDomProvider = CodeDomProvider.CreateProvider("C#");
+ CompilerParameters par = new CompilerParameters();
+ AssemblyName msbuildFrameworkName = engine.Assembly.GetName();
+ msbuildFrameworkName.Name = "Microsoft.Build.Framework";
+ Assembly msbuildFramework = Assembly.Load(msbuildFrameworkName);
+ //string pth = Path.Combine(Path.GetDirectoryName(engine.Assembly.Location), "Microsoft.Build.Framework.dll");
+ //par.ReferencedAssemblies.Add(pth);
+ par.ReferencedAssemblies.Add(msbuildFramework.Location);
+ par.ReferencedAssemblies.Add(typeof(NAnt.Core.Task).Assembly.Location);
+ par.ReferencedAssemblies.Add(typeof(NAntLogger).Assembly.Location);
+ CompilerResults res = codeDomProvider.CompileAssemblyFromSource(par, _impl);
+ if (res.Errors.HasErrors) {
+ return null;
+ }
+
+ Type t = res.CompiledAssembly.GetType("NAntLoggerImpl");
+ return (NAntLogger)Activator.CreateInstance(t, task, verbosity);
+ }
+
+ private const string _impl = @"
+ using System;
+ using Microsoft.Build.Framework;
+ using NAnt.Core;
+ using NAnt.MSBuild;
+ internal class NAntLoggerImpl : NAntLogger, ILogger {
private readonly Task _task;
private LoggerVerbosity _verbosity;
- public NAntLogger(Task task, LoggerVerbosity verbosity) {
+ public NAntLoggerImpl(Task task, NAntLoggerVerbosity verbosity) {
_task = task;
- _verbosity = verbosity;
+ _verbosity = (LoggerVerbosity)verbosity;
}
/// <summary>
@@ -48,19 +87,19 @@
private string GetLocation(string file,int lineNumber, int columnNumber) {
if (lineNumber != 0 || columnNumber != 0)
- return String.Format("{2}({0},{1}): ", lineNumber, columnNumber,file);
- if (file != "")
- return file + ": ";
- return "";
+ return String.Format(""{2}({0},{1}): "", lineNumber, columnNumber,file);
+ if (file.Length != 0)
+ return file + "": "";
+ return string.Empty;
}
void eventSource_ErrorRaised(object sender, BuildErrorEventArgs e) {
- string line = String.Format("{1}Error {0}: {2}", e.Code, GetLocation(e.File,e.LineNumber, e.ColumnNumber), e.Message);
+ string line = String.Format(""{1}Error {0}: {2}"", e.Code, GetLocation(e.File,e.LineNumber, e.ColumnNumber), e.Message);
_task.Log(Level.Error, line);
}
void eventSource_WarningRaised(object sender, BuildWarningEventArgs e) {
- string line = String.Format("{1}Warning {0}: {2}", e.Code, GetLocation(e.File,e.LineNumber, e.ColumnNumber), e.Message);
+ string line = String.Format(""{1}Warning {0}: {2}"", e.Code, GetLocation(e.File,e.LineNumber, e.ColumnNumber), e.Message);
_task.Log(Level.Warning, line);
}
@@ -77,7 +116,7 @@
lev = Level.Verbose;
break;
}
- switch (_verbosity) {
+ switch (Verbosity) {
case LoggerVerbosity.Quiet:
lev -= 2000;
break;
@@ -105,22 +144,21 @@
}
public string Parameters {
- get {
- return "";
- }
- set {
- }
+ get { return string.Empty; }
+ set { }
}
- public void Shutdown() {
+ public void Shutdown() {
}
public LoggerVerbosity Verbosity {
get { return _verbosity; }
set { _verbosity = value; }
}
+ }
+ ";
- private class DummyTask : Task {
+ protected class DummyTask : Task {
string _name;
public DummyTask(Project p, string name) {
@@ -129,7 +167,7 @@
}
public override string Name {
- get { return _name;}
+ get { return _name; }
}
protected override void ExecuteTask() {
Index: src/NAnt.MSBuild/WhidbeySolution.cs
===================================================================
RCS file: src/NAnt.MSBuild/WhidbeySolution.cs
diff -N src/NAnt.MSBuild/WhidbeySolution.cs
--- src/NAnt.MSBuild/WhidbeySolution.cs 8 Apr 2010 14:15:21 -0000 1.4
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,122 +0,0 @@
-// NAnt - A .NET build tool
-// Copyright (C) 2001-2004 Gerry Shaw
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation; either version 2 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// Martin Aliger ([email protected])
-// Matthew Mastracci ([email protected])
-// Gert Driesen ([email protected])
-
-using System;
-using System.CodeDom.Compiler;
-using System.Collections;
-using System.Collections.Specialized;
-using System.Globalization;
-using System.IO;
-using System.Text.RegularExpressions;
-
-using NAnt.Core;
-using NAnt.Core.Util;
-
-using NAnt.VSNet;
-using NAnt.VSNet.Tasks;
-
-namespace NAnt.VSNet {
- /// <summary>
- /// Analyses Microsoft Visual Studio .NET 2005 (Whidbey) solution files.
- /// </summary>
- internal class WhidbeySolution : SolutionBase {
- private const string SolutionFolder_GUID = "{2150E333-8FDC-42A3-9474-1A3956D46DE8}";
-
- public WhidbeySolution(string solutionContent, SolutionTask solutionTask, TempFileCollection tfc, GacCache gacCache, ReferencesResolver refResolver)
- : base(solutionTask, tfc, gacCache, refResolver) {
- Regex reProjects = new Regex(@"Project\(\""(?<package>\{.*?\})\"".*?\""(?<name>.*?)\"".*?\""(?<project>.*?)\"".*?\""(?<guid>.*?)\""(?<all>[\s\S]*?)EndProject", RegexOptions.Multiline);
- MatchCollection projectMatches = reProjects.Matches(solutionContent);
-
- Hashtable explicitProjectDependencies = CollectionsUtil.CreateCaseInsensitiveHashtable();
-
- foreach (Match projectMatch in projectMatches) {
- string project = projectMatch.Groups["project"].Value;
- string guid = projectMatch.Groups["guid"].Value;
- string package = projectMatch.Groups["package"].Value;
-
- // bug #1732361: skip solution folders
- if (package == SolutionFolder_GUID)
- continue;
-
- // translate partial project path or URL to absolute path
- string fullProjectPath = TranslateProjectPath(solutionTask.SolutionFile.DirectoryName,
- project);
-
- if (ManagedProjectBase.IsEnterpriseTemplateProject(fullProjectPath)) {
- RecursiveLoadTemplateProject(fullProjectPath);
- }
- else {
- // add project entry to collection
- ProjectEntries.Add(new ProjectEntry(guid, fullProjectPath));
- }
-
- // set-up project dependencies
- Regex reDependencies = new Regex(@"^\s+(?<guid>\{[0-9a-zA-Z]{8}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{12}\})\s+=\s+(?<dep>\{[0-9a-zA-Z]{8}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{12}\})", RegexOptions.Multiline);
- MatchCollection dependencyMatches = reDependencies.Matches(projectMatch.Value);
-
- foreach (Match dependencyMatch in dependencyMatches) {
- string dependency = dependencyMatch.Groups["dep"].Value;
-
- if (!explicitProjectDependencies.ContainsKey(guid)) {
- explicitProjectDependencies[guid] = CollectionsUtil.CreateCaseInsensitiveHashtable();
- }
- ((Hashtable)explicitProjectDependencies[guid])[dependency] = null;
- }
-
- // set-up project configuration
- Regex reProjectBuildConfig = new Regex(@"^\s+" + Regex.Escape(guid) + @"\.(?<solutionConfiguration>[^|]+)\|(?<solutionPlatform>[^.]+)\.Build\.0\s*=\s*(?<projectConfiguration>[^|]+)\|(?<projectPlatform>[\.\w ]+)\s*", RegexOptions.Multiline);
- MatchCollection projectBuildMatches = reProjectBuildConfig.Matches(solutionContent);
-
- ProjectEntry projectEntry = ProjectEntries [guid];
- if (projectEntry == null) {
- // TODO: determine if we should report an error if a build
- // configuration is defined for a project that does not
- // exist in the solution
- continue;
- }
-
- // holds mapping between project configuration(s) and solution(s)
- ConfigurationMap buildConfigurations = new ConfigurationMap(
- projectBuildMatches.Count);
-
- for (int i = 0; i < projectBuildMatches.Count; i++) {
- Match projectBuildMatch = projectBuildMatches [i];
- string solutionConfigName = projectBuildMatch.Groups["solutionConfiguration"].Value;
- string solutionPlatform = projectBuildMatch.Groups["solutionPlatform"].Value;
- string projectConfigName = projectBuildMatch.Groups["projectConfiguration"].Value;
- string projectPlatform = projectBuildMatch.Groups["projectPlatform"].Value;
- Configuration solutionConfig = new Configuration(
- solutionConfigName, solutionPlatform);
- Configuration projectConfig = new Configuration(
- projectConfigName, projectPlatform);
- buildConfigurations [solutionConfig] = projectConfig;
- }
-
- // add map to corresponding project entry
- projectEntry.BuildConfigurations = buildConfigurations;
- }
-
- LoadProjectGuids(new ArrayList(solutionTask.Projects.FileNames), false);
- LoadProjectGuids(new ArrayList(solutionTask.ReferenceProjects.FileNames), true);
- LoadProjects(gacCache, refResolver, explicitProjectDependencies);
- }
- }
-}
Index: src/NAnt.MSBuild/WhidbeySolutionProvider.cs
===================================================================
RCS file: src/NAnt.MSBuild/WhidbeySolutionProvider.cs
diff -N src/NAnt.MSBuild/WhidbeySolutionProvider.cs
--- src/NAnt.MSBuild/WhidbeySolutionProvider.cs 22 Dec 2006 17:30:24 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,55 +0,0 @@
-// NAnt - A .NET build tool
-// Copyright (C) 2001-2004 Gerry Shaw
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation; either version 2 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// Martin Aliger ([email protected])
-
-using System;
-using System.CodeDom.Compiler;
-using System.Text.RegularExpressions;
-using System.Xml;
-
-using NAnt.Core;
-using NAnt.Core.Util;
-
-using NAnt.VSNet;
-using NAnt.VSNet.Extensibility;
-using NAnt.VSNet.Tasks;
-
-namespace NAnt.VSNet {
- internal class WhidbeySolutionProvider : ISolutionBuildProvider {
- #region Implementation of ISolutionBuildProvider
-
- public int IsSupported(string fileContents) {
- Regex reSolutionFormat = new Regex(@"^\s*Microsoft Visual Studio Solution File, Format Version\s+(?<formatVersion>[0-9]+\.[0-9]+)", RegexOptions.Singleline);
- MatchCollection matches = reSolutionFormat.Matches(fileContents);
-
- if (matches.Count == 0)
- return 0;
-
- string formatVersion = matches[0].Groups["formatVersion"].Value;
- if (formatVersion == "9.00")
- return 10;
- return 0;
- }
-
- public SolutionBase GetInstance(string solutionContent, SolutionTask solutionTask, TempFileCollection tfc, GacCache gacCache, ReferencesResolver refResolver) {
- return new WhidbeySolution(solutionContent, solutionTask, tfc, gacCache, refResolver);
- }
-
- #endregion Implementation of ISolutionBuildProvider
- }
-}
Index: src/NAnt.MSBuild/MSBuild/BuildItem.cs
===================================================================
RCS file: src/NAnt.MSBuild/MSBuild/BuildItem.cs
diff -N src/NAnt.MSBuild/MSBuild/BuildItem.cs
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/NAnt.MSBuild/MSBuild/BuildItem.cs 23 May 2011 00:36:31 -0000
@@ -0,0 +1,48 @@
+// NAnt - A .NET build tool
+// Copyright (C) 2001-2011 Gerry Shaw
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// Martin Aliger ([email protected])
+
+using System;
+using System.Collections;
+using System.Text;
+using System.Reflection;
+using System.IO;
+
+namespace Microsoft.Build.BuildEngine {
+ internal class BuildItem {
+ object _obj;
+ Type _t;
+
+ internal BuildItem(object o) {
+ _obj = o;
+ _t = _obj.GetType();
+ }
+
+ public string FinalItemSpec {
+ get { return (string)_t.GetProperty("FinalItemSpec").GetValue(_obj, null); }
+ }
+
+ public string GetMetadata(string metadataName) {
+ return (string)_t.GetMethod("GetMetadata").Invoke(_obj, new object[] { metadataName });
+ }
+
+ public void SetMetadata(string metadataName, string metadataValue) {
+ _t.GetMethod("SetMetadata", new Type[] { typeof(string), typeof(string) }).Invoke(_obj, new object[] { metadataName, metadataValue });
+ }
+ }
+}
Index: src/NAnt.MSBuild/MSBuild/BuildItemGroup.cs
===================================================================
RCS file: src/NAnt.MSBuild/MSBuild/BuildItemGroup.cs
diff -N src/NAnt.MSBuild/MSBuild/BuildItemGroup.cs
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/NAnt.MSBuild/MSBuild/BuildItemGroup.cs 23 May 2011 00:36:31 -0000
@@ -0,0 +1,67 @@
+// NAnt - A .NET build tool
+// Copyright (C) 2001-2011 Gerry Shaw
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// Martin Aliger ([email protected])
+
+using System;
+using System.Collections;
+using System.Text;
+using System.Reflection;
+using System.IO;
+
+namespace Microsoft.Build.BuildEngine {
+ internal class BuildItemGroup {
+
+ #region Enumerator
+ private class BuildItemEnumerator : IEnumerator {
+ IEnumerator _po;
+
+ internal BuildItemEnumerator(IEnumerator po) {
+ _po = po;
+ }
+
+ public object Current {
+ get { return new BuildItem(_po.Current); }
+ }
+
+ public bool MoveNext() {
+ return _po.MoveNext();
+ }
+
+ public void Reset() {
+ _po.Reset();
+ }
+ }
+ #endregion
+
+ object _obj;
+ Type _t;
+
+ internal BuildItemGroup(object o) {
+ _obj = o;
+ _t = _obj.GetType();
+ }
+
+ public System.Collections.IEnumerator GetEnumerator() {
+ return new BuildItemEnumerator((IEnumerator)_t.GetMethod("GetEnumerator").Invoke(_obj, null));
+ }
+
+ public BuildItem AddNewItem(string itemName, string itemInclude) {
+ return new BuildItem(_t.GetMethod("AddNewItem", new Type[] { typeof(string), typeof(string) }).Invoke(_obj, new object[] { itemName, itemInclude }));
+ }
+ }
+}
Index: src/NAnt.MSBuild/MSBuild/BuildPropertyGroup.cs
===================================================================
RCS file: src/NAnt.MSBuild/MSBuild/BuildPropertyGroup.cs
diff -N src/NAnt.MSBuild/MSBuild/BuildPropertyGroup.cs
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/NAnt.MSBuild/MSBuild/BuildPropertyGroup.cs 23 May 2011 00:36:31 -0000
@@ -0,0 +1,40 @@
+// NAnt - A .NET build tool
+// Copyright (C) 2001-2011 Gerry Shaw
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// Martin Aliger ([email protected])
+
+using System;
+using System.Collections;
+using System.Text;
+using System.Reflection;
+using System.IO;
+
+namespace Microsoft.Build.BuildEngine {
+ internal class BuildPropertyGroup {
+ object _obj;
+ Type _t;
+
+ internal BuildPropertyGroup(object o) {
+ _obj = o;
+ _t = _obj.GetType();
+ }
+
+ public void SetProperty(string propertyName, string propertyValue) {
+ _t.GetMethod("SetProperty", new Type[] { typeof(string), typeof(string) }).Invoke(_obj, new object[] { propertyName, propertyValue });
+ }
+ }
+}
Index: src/NAnt.MSBuild/MSBuild/Engine.cs
===================================================================
RCS file: src/NAnt.MSBuild/MSBuild/Engine.cs
diff -N src/NAnt.MSBuild/MSBuild/Engine.cs
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/NAnt.MSBuild/MSBuild/Engine.cs 23 May 2011 00:36:31 -0000
@@ -0,0 +1,122 @@
+// NAnt - A .NET build tool
+// Copyright (C) 2001-2011 Gerry Shaw
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// Martin Aliger ([email protected])
+
+using System;
+using System.Collections;
+using System.Text;
+using System.Reflection;
+using System.IO;
+
+namespace Microsoft.Build.BuildEngine {
+ internal class Engine : MarshalByRefObject {
+ object _obj;
+ Type _t;
+ Assembly _a;
+
+ private Engine() {
+ }
+
+ public static Engine LoadEngine(NAnt.Core.FrameworkInfo framework) {
+ //System.AppDomainSetup myDomainSetup = new System.AppDomainSetup();
+ //myDomainSetup.ApplicationBase = AppDomain.CurrentDomain.BaseDirectory;
+ //myDomainSetup.ApplicationName = "MSBuild";
+
+ //string tempFile = Path.GetTempFileName();
+ //using (StreamWriter sw = File.CreateText(tempFile))
+ //{
+ // sw.WriteLine(String.Format(
+ // "<?xml version='1.0'?><configuration><runtime>"
+ // + "<assemblyBinding xmlns='urn:schemas-microsoft-com:asm.v1'>"
+ // + "<dependentAssembly><assemblyIdentity name='Microsoft.Build.Framework' publicKeyToken='b03f5f7f11d50a3a' culture='neutral'/><bindingRedirect oldVersion='0.0.0.0-99.9.9.9' newVersion='{0}'/></dependentAssembly>"
+ // + "<dependentAssembly><assemblyIdentity name='Microsoft.Build.Engine' publicKeyToken='b03f5f7f11d50a3a' culture='neutral'/><bindingRedirect oldVersion='0.0.0.0-99.9.9.9' newVersion='{0}'/></dependentAssembly>"
+ // + "</assemblyBinding></runtime></configuration>",
+ // new Version(framework.Version.Major, framework.Version.Minor, 0, 0)));
+ //}
+
+ //myDomainSetup.ConfigurationFile = tempFile;// AppDomain.CurrentDomain.SetupInformation.ConfigurationFile;
+
+ //var executionAD = AppDomain.CreateDomain(myDomainSetup.ApplicationName,
+ // AppDomain.CurrentDomain.Evidence, myDomainSetup);
+ //AppDomain.CurrentDomain.AssemblyLoad += new AssemblyLoadEventHandler(CurrentDomain_AssemblyLoad);
+ //executionAD.AssemblyLoad += new AssemblyLoadEventHandler(executionAD_AssemblyLoad);
+
+ //File.Delete(tempFile);
+
+ //Loader l = (Loader)executionAD.CreateInstanceAndUnwrap(typeof(Loader).Assembly.FullName, typeof(Loader).FullName);
+ Loader l = new Loader();
+ l.framework = framework;
+ //executionAD.DoCallBack(new CrossAppDomainDelegate(l.DoLoad));
+ l.DoLoad();
+ return l.engine;
+ }
+
+ //[Serializable]
+ public class Loader : MarshalByRefObject {
+ public NAnt.Core.FrameworkInfo framework;
+ public Engine engine;
+
+ public void DoLoad() {
+ engine = new Engine();
+ string pth = Path.Combine(framework.FrameworkDirectory.FullName, "Microsoft.Build.Engine.dll");
+ if (File.Exists(pth)) {
+ engine._a = Assembly.LoadFile(pth);
+ } else {
+ //frameworks 3.0 and 3.5 do not copy its assemblies into filesystem. They reside just in assembly cache (GAC)
+
+ //Microsoft.Build.Engine, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+ AssemblyName an = new AssemblyName("Microsoft.Build.Engine");
+ an.Version = new Version(framework.Version.Major, framework.Version.Minor, 0, 0);
+ an.CultureInfo = System.Globalization.CultureInfo.InvariantCulture;
+ an.SetPublicKeyToken(new byte[] { 0xb0, 0x3f, 0x5f, 0x7f, 0x11, 0xd5, 0x0a, 0x3a });
+
+ engine._a = Assembly.Load(an); //load from GAC
+ }
+ engine._t = engine._a.GetType("Microsoft.Build.BuildEngine.Engine");
+ engine._obj = Activator.CreateInstance(engine._t);
+
+ //2.0
+ if (engine._a.GetName().Version.Major == 2) {
+ engine._t.GetProperty("BinPath").SetValue(engine._obj, framework.FrameworkDirectory.FullName, null);
+ }
+ }
+ }
+
+ static void executionAD_AssemblyLoad(object sender, AssemblyLoadEventArgs args) {
+ }
+
+ static void CurrentDomain_AssemblyLoad(object sender, AssemblyLoadEventArgs args) {
+ }
+
+ internal Assembly Assembly {
+ get { return _a; }
+ }
+
+ internal object Object {
+ get { return _obj; }
+ }
+
+ public void UnregisterAllLoggers() {
+ _t.GetMethod("UnregisterAllLoggers").Invoke(_obj, null);
+ }
+
+ public void RegisterLogger(/*ILogger*/object logger) {
+ _t.GetMethod("RegisterLogger").Invoke(_obj, new object[] {logger});
+ }
+ }
+}
Index: src/NAnt.MSBuild/MSBuild/Project.cs
===================================================================
RCS file: src/NAnt.MSBuild/MSBuild/Project.cs
diff -N src/NAnt.MSBuild/MSBuild/Project.cs
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/NAnt.MSBuild/MSBuild/Project.cs 23 May 2011 00:36:31 -0000
@@ -0,0 +1,78 @@
+// NAnt - A .NET build tool
+// Copyright (C) 2001-2011 Gerry Shaw
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// Martin Aliger ([email protected])
+
+using System;
+using System.Collections;
+using System.Text;
+using System.Reflection;
+using System.IO;
+
+namespace Microsoft.Build.BuildEngine {
+ internal class Project {
+ object _obj;
+ Type _t;
+
+ public Project(Engine engine) {
+ _t = engine.Assembly.GetType("Microsoft.Build.BuildEngine.Project");
+ _obj = Activator.CreateInstance(_t, engine.Object);
+ }
+
+ public string FullFileName {
+ get { return (string)_t.GetProperty("FullFileName").GetValue(_obj, null); }
+ set { _t.GetProperty("FullFileName").SetValue(_obj, value, null); }
+ }
+
+ private PropertyInfo ToolsVersionPI {
+ get { return _t.GetProperty("ToolsVersion"); }
+ }
+
+ public string ToolsVersion {
+ get { PropertyInfo pi = ToolsVersionPI; if (pi == null) return "2.0"; return (string)pi.GetValue(_obj, null); }
+ set { PropertyInfo pi = ToolsVersionPI; if (pi == null) return; pi.SetValue(_obj, value, null); }
+ }
+
+ public void LoadXml(string projectXml) {
+ _t.GetMethod("LoadXml", new Type[] { typeof(string) }).Invoke(_obj, new object[] { projectXml });
+ }
+
+ public BuildPropertyGroup GlobalProperties {
+ get { return new BuildPropertyGroup(_t.GetProperty("GlobalProperties").GetValue(_obj, null)); }
+ }
+
+ public string GetEvaluatedProperty(string propertyName) {
+ return (string)_t.GetMethod("GetEvaluatedProperty").Invoke(_obj, new object[] { propertyName });
+ }
+
+ public BuildItemGroup GetEvaluatedItemsByName(string itemName) {
+ return new BuildItemGroup(_t.GetMethod("GetEvaluatedItemsByName").Invoke(_obj, new object[] { itemName }));
+ }
+
+ public void RemoveItemsByName(string itemName) {
+ _t.GetMethod("RemoveItemsByName").Invoke(_obj, new object[] { itemName });
+ }
+
+ public BuildItemGroup AddNewItemGroup() {
+ return new BuildItemGroup(_t.GetMethod("AddNewItemGroup").Invoke(_obj, null));
+ }
+
+ public bool Build() {
+ return (bool) _t.GetMethod("Build", new Type[] {}).Invoke(_obj, null);
+ }
+ }
+}
Index: src/NAnt.MSBuild/VS2005/WhidbeySolution.cs
===================================================================
RCS file: src/NAnt.MSBuild/VS2005/WhidbeySolution.cs
diff -N src/NAnt.MSBuild/VS2005/WhidbeySolution.cs
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/NAnt.MSBuild/VS2005/WhidbeySolution.cs 23 May 2011 00:36:31 -0000
@@ -0,0 +1,122 @@
+// NAnt - A .NET build tool
+// Copyright (C) 2001-2004 Gerry Shaw
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// Martin Aliger ([email protected])
+// Matthew Mastracci ([email protected])
+// Gert Driesen ([email protected])
+
+using System;
+using System.CodeDom.Compiler;
+using System.Collections;
+using System.Collections.Specialized;
+using System.Globalization;
+using System.IO;
+using System.Text.RegularExpressions;
+
+using NAnt.Core;
+using NAnt.Core.Util;
+
+using NAnt.VSNet;
+using NAnt.VSNet.Tasks;
+
+namespace NAnt.VSNet {
+ /// <summary>
+ /// Analyses Microsoft Visual Studio .NET 2005 (Whidbey) solution files.
+ /// </summary>
+ internal class WhidbeySolution : SolutionBase {
+ private const string SolutionFolder_GUID = "{2150E333-8FDC-42A3-9474-1A3956D46DE8}";
+
+ public WhidbeySolution(string solutionContent, SolutionTask solutionTask, TempFileCollection tfc, GacCache gacCache, ReferencesResolver refResolver)
+ : base(solutionTask, tfc, gacCache, refResolver) {
+ Regex reProjects = new Regex(@"Project\(\""(?<package>\{.*?\})\"".*?\""(?<name>.*?)\"".*?\""(?<project>.*?)\"".*?\""(?<guid>.*?)\""(?<all>[\s\S]*?)EndProject", RegexOptions.Multiline);
+ MatchCollection projectMatches = reProjects.Matches(solutionContent);
+
+ Hashtable explicitProjectDependencies = CollectionsUtil.CreateCaseInsensitiveHashtable();
+
+ foreach (Match projectMatch in projectMatches) {
+ string project = projectMatch.Groups["project"].Value;
+ string guid = projectMatch.Groups["guid"].Value;
+ string package = projectMatch.Groups["package"].Value;
+
+ // bug #1732361: skip solution folders
+ if (package == SolutionFolder_GUID) {
+ continue;
+ }
+
+ // translate partial project path or URL to absolute path
+ string fullProjectPath = TranslateProjectPath(solutionTask.SolutionFile.DirectoryName,
+ project);
+
+ if (ManagedProjectBase.IsEnterpriseTemplateProject(fullProjectPath)) {
+ RecursiveLoadTemplateProject(fullProjectPath);
+ } else {
+ // add project entry to collection
+ ProjectEntries.Add(new ProjectEntry(guid, fullProjectPath));
+ }
+
+ // set-up project dependencies
+ Regex reDependencies = new Regex(@"^\s+(?<guid>\{[0-9a-zA-Z]{8}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{12}\})\s+=\s+(?<dep>\{[0-9a-zA-Z]{8}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{12}\})", RegexOptions.Multiline);
+ MatchCollection dependencyMatches = reDependencies.Matches(projectMatch.Value);
+
+ foreach (Match dependencyMatch in dependencyMatches) {
+ string dependency = dependencyMatch.Groups["dep"].Value;
+
+ if (!explicitProjectDependencies.ContainsKey(guid)) {
+ explicitProjectDependencies[guid] = CollectionsUtil.CreateCaseInsensitiveHashtable();
+ }
+ ((Hashtable)explicitProjectDependencies[guid])[dependency] = null;
+ }
+
+ // set-up project configuration
+ Regex reProjectBuildConfig = new Regex(@"^\s+" + Regex.Escape(guid) + @"\.(?<solutionConfiguration>[^|]+)\|(?<solutionPlatform>[^.]+)\.Build\.0\s*=\s*(?<projectConfiguration>[^|]+)\|(?<projectPlatform>[\.\w ]+)\s*", RegexOptions.Multiline);
+ MatchCollection projectBuildMatches = reProjectBuildConfig.Matches(solutionContent);
+
+ ProjectEntry projectEntry = ProjectEntries [guid];
+ if (projectEntry == null) {
+ // TODO: determine if we should report an error if a build
+ // configuration is defined for a project that does not
+ // exist in the solution
+ continue;
+ }
+
+ // holds mapping between project configuration(s) and solution(s)
+ ConfigurationMap buildConfigurations = new ConfigurationMap(
+ projectBuildMatches.Count);
+
+ for (int i = 0; i < projectBuildMatches.Count; i++) {
+ Match projectBuildMatch = projectBuildMatches [i];
+ string solutionConfigName = projectBuildMatch.Groups["solutionConfiguration"].Value;
+ string solutionPlatform = projectBuildMatch.Groups["solutionPlatform"].Value;
+ string projectConfigName = projectBuildMatch.Groups["projectConfiguration"].Value;
+ string projectPlatform = projectBuildMatch.Groups["projectPlatform"].Value;
+ Configuration solutionConfig = new Configuration(
+ solutionConfigName, solutionPlatform);
+ Configuration projectConfig = new Configuration(
+ projectConfigName, projectPlatform);
+ buildConfigurations [solutionConfig] = projectConfig;
+ }
+
+ // add map to corresponding project entry
+ projectEntry.BuildConfigurations = buildConfigurations;
+ }
+
+ LoadProjectGuids(new ArrayList(solutionTask.Projects.FileNames), false);
+ LoadProjectGuids(new ArrayList(solutionTask.ReferenceProjects.FileNames), true);
+ LoadProjects(gacCache, refResolver, explicitProjectDependencies);
+ }
+ }
+}
Index: src/NAnt.MSBuild/VS2005/WhidbeySolutionProvider.cs
===================================================================
RCS file: src/NAnt.MSBuild/VS2005/WhidbeySolutionProvider.cs
diff -N src/NAnt.MSBuild/VS2005/WhidbeySolutionProvider.cs
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/NAnt.MSBuild/VS2005/WhidbeySolutionProvider.cs 23 May 2011 00:36:31 -0000
@@ -0,0 +1,57 @@
+// NAnt - A .NET build tool
+// Copyright (C) 2001-2004 Gerry Shaw
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// Martin Aliger ([email protected])
+
+using System;
+using System.CodeDom.Compiler;
+using System.Text.RegularExpressions;
+using System.Xml;
+
+using NAnt.Core;
+using NAnt.Core.Util;
+
+using NAnt.VSNet;
+using NAnt.VSNet.Extensibility;
+using NAnt.VSNet.Tasks;
+
+namespace NAnt.VSNet {
+ internal class WhidbeySolutionProvider : ISolutionBuildProvider {
+ #region Implementation of ISolutionBuildProvider
+
+ public int IsSupported(string fileContents) {
+ Regex reSolutionFormat = new Regex(@"^\s*Microsoft Visual Studio Solution File, Format Version\s+(?<formatVersion>[0-9]+\.[0-9]+)", RegexOptions.Singleline);
+ MatchCollection matches = reSolutionFormat.Matches(fileContents);
+
+ if (matches.Count == 0) {
+ return 0;
+ }
+
+ string formatVersion = matches[0].Groups["formatVersion"].Value;
+ if (formatVersion == "9.00") {
+ return 10;
+ }
+ return 0;
+ }
+
+ public SolutionBase GetInstance(string solutionContent, SolutionTask solutionTask, TempFileCollection tfc, GacCache gacCache, ReferencesResolver refResolver) {
+ return new WhidbeySolution(solutionContent, solutionTask, tfc, gacCache, refResolver);
+ }
+
+ #endregion Implementation of ISolutionBuildProvider
+ }
+}
Index: src/NAnt.MSBuild/VS2008/OrcasSolution.cs
===================================================================
RCS file: src/NAnt.MSBuild/VS2008/OrcasSolution.cs
diff -N src/NAnt.MSBuild/VS2008/OrcasSolution.cs
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/NAnt.MSBuild/VS2008/OrcasSolution.cs 23 May 2011 00:36:31 -0000
@@ -0,0 +1,46 @@
+// NAnt - A .NET build tool
+// Copyright (C) 2001-2004 Gerry Shaw
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// Martin Aliger ([email protected])
+// Matthew Mastracci ([email protected])
+// Gert Driesen ([email protected])
+
+using System;
+using System.CodeDom.Compiler;
+using System.Collections;
+using System.Collections.Specialized;
+using System.Globalization;
+using System.IO;
+using System.Text.RegularExpressions;
+
+using NAnt.Core;
+using NAnt.Core.Util;
+
+using NAnt.VSNet;
+using NAnt.VSNet.Tasks;
+
+namespace NAnt.VSNet {
+ /// <summary>
+ /// Analyses Microsoft Visual Studio .NET 2008 (Orcas) solution files.
+ /// </summary>
+ internal class OrcasSolution : WhidbeySolution{
+ public OrcasSolution(string solutionContent, SolutionTask solutionTask, TempFileCollection tfc, GacCache gacCache, ReferencesResolver refResolver)
+ : base(solutionContent, solutionTask, tfc, gacCache, refResolver)
+ {
+ }
+ }
+}
Index: src/NAnt.MSBuild/VS2008/OrcasSolutionProvider.cs
===================================================================
RCS file: src/NAnt.MSBuild/VS2008/OrcasSolutionProvider.cs
diff -N src/NAnt.MSBuild/VS2008/OrcasSolutionProvider.cs
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/NAnt.MSBuild/VS2008/OrcasSolutionProvider.cs 23 May 2011 00:36:31 -0000
@@ -0,0 +1,58 @@
+// NAnt - A .NET build tool
+// Copyright (C) 2001-2011 Gerry Shaw
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// Martin Aliger ([email protected])
+
+using System;
+using System.CodeDom.Compiler;
+using System.Text.RegularExpressions;
+using System.Xml;
+
+using NAnt.Core;
+using NAnt.Core.Util;
+
+using NAnt.VSNet;
+using NAnt.VSNet.Extensibility;
+using NAnt.VSNet.Tasks;
+
+namespace NAnt.VSNet {
+ internal class OrcasSolutionProvider : ISolutionBuildProvider {
+ #region Implementation of ISolutionBuildProvider
+
+ public int IsSupported(string fileContents) {
+ Regex reSolutionFormat = new Regex(@"^\s*Microsoft Visual Studio Solution File, Format Version\s+(?<formatVersion>[0-9]+\.[0-9]+)", RegexOptions.Singleline);
+ MatchCollection matches = reSolutionFormat.Matches(fileContents);
+
+ if (matches.Count == 0) {
+ return 0;
+ }
+
+ string formatVersion = matches[0].Groups["formatVersion"].Value;
+ if (formatVersion == "10.00") {
+ return 10;
+ }
+ return 0;
+ }
+
+ public SolutionBase GetInstance(string solutionContent, SolutionTask solutionTask, TempFileCollection tfc, GacCache gacCache, ReferencesResolver refResolver) {
+ return new OrcasSolution(solutionContent, solutionTask, tfc, gacCache, refResolver);
+ }
+
+ #endregion Implementation of ISolutionBuildProvider
+ }
+}
+
Index: src/NAnt.MSBuild/VS2010/RosarioSolution.cs
===================================================================
RCS file: src/NAnt.MSBuild/VS2010/RosarioSolution.cs
diff -N src/NAnt.MSBuild/VS2010/RosarioSolution.cs
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/NAnt.MSBuild/VS2010/RosarioSolution.cs 23 May 2011 00:36:31 -0000
@@ -0,0 +1,44 @@
+// NAnt - A .NET build tool
+// Copyright (C) 2001-2011 Gerry Shaw
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// Martin Aliger ([email protected])
+
+using System;
+using System.CodeDom.Compiler;
+using System.Collections;
+using System.Collections.Specialized;
+using System.Globalization;
+using System.IO;
+using System.Text.RegularExpressions;
+
+using NAnt.Core;
+using NAnt.Core.Util;
+
+using NAnt.VSNet;
+using NAnt.VSNet.Tasks;
+
+namespace NAnt.VSNet {
+ /// <summary>
+ /// Analyses Microsoft Visual Studio .NET 2010 (Rosario) solution files.
+ /// </summary>
+ internal class RosarioSolution : WhidbeySolution{
+ public RosarioSolution(string solutionContent, SolutionTask solutionTask, TempFileCollection tfc, GacCache gacCache, ReferencesResolver refResolver)
+ : base(solutionContent, solutionTask, tfc, gacCache, refResolver)
+ {
+ }
+ }
+}
Index: src/NAnt.MSBuild/VS2010/RosarioSolutionProvider.cs
===================================================================
RCS file: src/NAnt.MSBuild/VS2010/RosarioSolutionProvider.cs
diff -N src/NAnt.MSBuild/VS2010/RosarioSolutionProvider.cs
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/NAnt.MSBuild/VS2010/RosarioSolutionProvider.cs 23 May 2011 00:36:31 -0000
@@ -0,0 +1,58 @@
+// NAnt - A .NET build tool
+// Copyright (C) 2001-2011 Gerry Shaw
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// Martin Aliger ([email protected])
+
+using System;
+using System.CodeDom.Compiler;
+using System.Text.RegularExpressions;
+using System.Xml;
+
+using NAnt.Core;
+using NAnt.Core.Util;
+
+using NAnt.VSNet;
+using NAnt.VSNet.Extensibility;
+using NAnt.VSNet.Tasks;
+
+namespace NAnt.VSNet {
+ internal class RosarioSolutionProvider : ISolutionBuildProvider {
+ #region Implementation of ISolutionBuildProvider
+
+ public int IsSupported(string fileContents) {
+ Regex reSolutionFormat = new Regex(@"^\s*Microsoft Visual Studio Solution File, Format Version\s+(?<formatVersion>[0-9]+\.[0-9]+)", RegexOptions.Singleline);
+ MatchCollection matches = reSolutionFormat.Matches(fileContents);
+
+ if (matches.Count == 0) {
+ return 0;
+ }
+
+ string formatVersion = matches[0].Groups["formatVersion"].Value;
+ if (formatVersion == "11.00") {
+ return 10;
+ }
+ return 0;
+ }
+
+ public SolutionBase GetInstance(string solutionContent, SolutionTask solutionTask, TempFileCollection tfc, GacCache gacCache, ReferencesResolver refResolver) {
+ return new RosarioSolution(solutionContent, solutionTask, tfc, gacCache, refResolver);
+ }
+
+ #endregion Implementation of ISolutionBuildProvider
+ }
+}
+
Index: src/NAnt.VSNet/AssemblyReferenceBase.cs
===================================================================
RCS file: /cvsroot/nant/nant/src/NAnt.VSNet/AssemblyReferenceBase.cs,v
retrieving revision 1.12
diff -u -r1.12 AssemblyReferenceBase.cs
--- src/NAnt.VSNet/AssemblyReferenceBase.cs 8 Apr 2010 14:15:22 -0000 1.12
+++ src/NAnt.VSNet/AssemblyReferenceBase.cs 23 May 2011 00:36:31 -0000
@@ -250,8 +250,11 @@
/// in the framework assembly directory; otherwise, <see langword="null" />.
/// </returns>
protected string ResolveFromFramework(string fileName) {
- string systemAssembly = FileUtils.CombinePaths(SolutionTask.Project.TargetFramework.
- FrameworkAssemblyDirectory.FullName, fileName);
+
+ //string systemAssembly = FileUtils.CombinePaths(SolutionTask.Project.TargetFramework.
+ // FrameworkAssemblyDirectory.FullName, fileName);
+ string systemAssembly = SolutionTask.Project.TargetFramework.ResolveAssembly(fileName);
+
if (File.Exists(systemAssembly)) {
return systemAssembly;
}
VSNetUpdates.diff
(application/octet-stream, 10.8 KB)
Index: src/NAnt.VSNet/ProjectBase.cs
===================================================================
RCS file: /cvsroot/nant/nant/src/NAnt.VSNet/ProjectBase.cs,v
retrieving revision 1.45
diff -u -r1.45 ProjectBase.cs
--- src/NAnt.VSNet/ProjectBase.cs 27 Oct 2010 03:51:05 -0000 1.45
+++ src/NAnt.VSNet/ProjectBase.cs 18 May 2011 19:21:05 -0000
@@ -804,17 +804,27 @@
/// <summary>
/// Visual Studio.NET 2002
/// </summary>
- Rainier = 1,
+ Rainier = 70,
/// <summary>
/// Visual Studio.NET 2003
/// </summary>
- Everett = 2,
+ Everett = 71,
/// <summary>
/// Visual Studio 2005
/// </summary>
- Whidbey =3,
+ Whidbey = 80,
+
+ /// <summary>
+ /// Visual Studio 2008
+ /// </summary>
+ Orcas = 90,
+
+ /// <summary>
+ /// Visual Studio 2010
+ /// </summary>
+ Rosario = 100,
}
/// <summary>
Index: src/NAnt.VSNet/SolutionBase.cs
===================================================================
RCS file: /cvsroot/nant/nant/src/NAnt.VSNet/SolutionBase.cs,v
retrieving revision 1.34
diff -u -r1.34 SolutionBase.cs
--- src/NAnt.VSNet/SolutionBase.cs 9 Feb 2008 20:26:24 -0000 1.34
+++ src/NAnt.VSNet/SolutionBase.cs 18 May 2011 19:21:05 -0000
@@ -561,8 +561,16 @@
}
try {
+#if NET_2_0
+ Uri uri = null;
+ Uri.TryCreate(translatedPath, UriKind.Absolute, out uri);
+#else
Uri uri = new Uri(translatedPath);
- if (uri.Scheme == Uri.UriSchemeFile) {
+#endif
+ if(uri==null) {
+ translatedPath = FileUtils.GetFullPath(FileUtils.CombinePaths(
+ solutionDir, translatedPath));
+ } else if (uri.Scheme == Uri.UriSchemeFile) {
translatedPath = FileUtils.GetFullPath(FileUtils.CombinePaths(
solutionDir, uri.LocalPath));
} else {
Index: src/NAnt.VSNet/VcConfigurationBase.cs
===================================================================
RCS file: /cvsroot/nant/nant/src/NAnt.VSNet/VcConfigurationBase.cs,v
retrieving revision 1.12
diff -u -r1.12 VcConfigurationBase.cs
--- src/NAnt.VSNet/VcConfigurationBase.cs 8 Apr 2010 14:15:22 -0000 1.12
+++ src/NAnt.VSNet/VcConfigurationBase.cs 18 May 2011 19:21:05 -0000
@@ -116,9 +116,19 @@
if (usePCHString == null) {
return UsePrecompiledHeader.Unspecified;
}
+ int intVal = int.Parse(usePCHString, CultureInfo.InvariantCulture);
- return (UsePrecompiledHeader) Enum.ToObject(typeof(UsePrecompiledHeader),
- int.Parse(usePCHString, CultureInfo.InvariantCulture));
+ if (this.Project.ProductVersion >= ProductVersion.Whidbey) {
+ switch(intVal) {
+ case 0 :
+ return UsePrecompiledHeader.No;
+ case 1:
+ return UsePrecompiledHeader.Create;
+ case 2:
+ return UsePrecompiledHeader.Use;
+ }
+ }
+ return (UsePrecompiledHeader) Enum.ToObject(typeof(UsePrecompiledHeader), intVal);
}
}
Index: src/NAnt.VSNet/VcProject.cs
===================================================================
RCS file: /cvsroot/nant/nant/src/NAnt.VSNet/VcProject.cs,v
retrieving revision 1.80
diff -u -r1.80 VcProject.cs
--- src/NAnt.VSNet/VcProject.cs 27 Oct 2010 03:51:05 -0000 1.80
+++ src/NAnt.VSNet/VcProject.cs 18 May 2011 19:21:06 -0000
@@ -709,9 +709,28 @@
}
}
+ //exception handling stuff
string exceptionHandling = fileConfig.GetToolSetting(VcConfigurationBase.CLCompilerTool, "ExceptionHandling");
- if (exceptionHandling == null || string.Compare(exceptionHandling, "true", true, CultureInfo.InvariantCulture) == 0) {
- clTask.Arguments.Add(new Argument("/EHsc"));
+ if (exceptionHandling == null) {
+ if (ProductVersion >= ProductVersion.Whidbey) {
+ exceptionHandling = "2";
+ } else {
+ exceptionHandling = "false";
+ }
+ } else {
+ exceptionHandling = exceptionHandling.ToLower();
+ }
+ switch(exceptionHandling) {
+ case "0":
+ case "false":
+ break;
+ case "1":
+ case "true":
+ clTask.Arguments.Add(new Argument("/EHsc"));
+ break;
+ case "2":
+ clTask.Arguments.Add(new Argument("/EHa"));
+ break;
}
string browseInformation = fileConfig.GetToolSetting(VcConfigurationBase.CLCompilerTool, "BrowseInformation");
@@ -1825,14 +1844,17 @@
return false;
}
- try {
- GetProductVersion(docElement);
- // no need to perform version check here as this is done in
- // GetProductVersion
- } catch {
- // product version could not be determined or is not supported
- return false;
- }
+ //MAL 2007/12/20
+ //this is double check - really needed? In addition, when version check fails, it gives odd error.
+ //2nd check is made in DetermineProductVersion (called from ProjectBase constructor)
+ //try {
+ // GetProductVersion(docElement);
+ // // no need to perform version check here as this is done in
+ // // GetProductVersion
+ //} catch {
+ // // product version could not be determined or is not supported
+ // return false;
+ //}
return true;
}
@@ -1879,7 +1901,9 @@
// check if we're dealing with a valid version number
Version productVersion = null;
try {
- productVersion = new Version(productVersionAttribute.Value);
+ string ver = productVersionAttribute.Value;
+ ver = ver.Replace(',', '.'); //Whidbey (8,00) and Orcas (9,00) are using comma instead of point
+ productVersion = new Version(ver);
} catch (Exception ex) {
throw new BuildException(string.Format(CultureInfo.InvariantCulture,
"The value of the \"Version\" attribute ({0}) is not a valid"
@@ -1887,17 +1911,23 @@
Location.UnknownLocation, ex);
}
- if (productVersion.Major == 7) {
- switch (productVersion.Minor) {
- case 0:
- return ProductVersion.Rainier;
- case 10:
- return ProductVersion.Everett;
- }
+ switch(productVersion.Major) {
+ case 7:
+ switch (productVersion.Minor) {
+ case 0:
+ return ProductVersion.Rainier;
+ case 10:
+ return ProductVersion.Everett;
+ }
+ break;
+ case 8:
+ return ProductVersion.Whidbey;
+ case 9:
+ return ProductVersion.Orcas;
}
throw new BuildException(string.Format(CultureInfo.InvariantCulture,
- "Visual Studio version \"{0\" is not supported.",
+ "Visual Studio version \"{0}\" is not supported.",
productVersion.ToString()), Location.UnknownLocation);
}
Index: src/NAnt.VSNet/VcProjectConfiguration.cs
===================================================================
RCS file: /cvsroot/nant/nant/src/NAnt.VSNet/VcProjectConfiguration.cs,v
retrieving revision 1.14
diff -u -r1.14 VcProjectConfiguration.cs
--- src/NAnt.VSNet/VcProjectConfiguration.cs 8 Apr 2010 14:15:22 -0000 1.14
+++ src/NAnt.VSNet/VcProjectConfiguration.cs 18 May 2011 19:21:06 -0000
@@ -59,7 +59,18 @@
string managedExtentions = GetXmlAttributeValue(elem, "ManagedExtensions");
if (managedExtentions != null) {
- _managedExtensions = string.Compare(managedExtentions.Trim(), "true", true, CultureInfo.InvariantCulture) == 0;
+ switch(managedExtentions.ToLower()) {
+ case "false":
+ case "0":
+ _managedExtensions = false;
+ break;
+ case "true":
+ case "1":
+ _managedExtensions = true;
+ break;
+ default:
+ throw new BuildException(String.Format("ManagedExtensions '{0}' is not supported yet.",managedExtentions));
+ }
}
// get configuration type
Index: src/NAnt.VSNet/Tasks/SolutionTask.cs
===================================================================
RCS file: /cvsroot/nant/nant/src/NAnt.VSNet/Tasks/SolutionTask.cs,v
retrieving revision 1.57
diff -u -r1.57 SolutionTask.cs
--- src/NAnt.VSNet/Tasks/SolutionTask.cs 3 May 2011 23:59:18 -0000 1.57
+++ src/NAnt.VSNet/Tasks/SolutionTask.cs 18 May 2011 19:21:06 -0000
@@ -194,12 +194,19 @@
[PluginConsumer(typeof(IProjectBuildProvider))]
[PluginConsumer(typeof(ISolutionBuildProvider))]
public class SolutionTask : Task, IPluginConsumer {
+
+ /// <summary>
+ /// Private var containing custom properties.
+ /// </summary>
+ ArrayList _customproperties;
+
#region Public Instance Constructors
/// <summary>
/// Initializes a new instance of the <see cref="SolutionTask" /> class.
/// </summary>
public SolutionTask() {
+ _customproperties = new ArrayList();
_projects = new FileSet();
_referenceProjects = new FileSet();
_excludeProjects = new FileSet();
@@ -350,6 +357,19 @@
}
/// <summary>
+ /// Set of properties set at solution level. Builders for projects in solution may or may not use them.
+ /// </summary>
+ /// <remarks>
+ /// <para>
+ /// TODO: some documentataion which properties could be defined here.
+ /// </para>
+ /// </remarks>
+ [BuildElementArray("property", ElementType = typeof(PropertyTask))]
+ public ArrayList CustomProperties {
+ get { return _customproperties; }
+ }
+
+ /// <summary>
/// Gets the list of folders to scan for assembly references.
/// </summary>
/// <value>