IEnumerable<ProjectElement> Import (ProjectImportElement import)
{
string dir = ProjectCollection.GetEvaluationTimeThisFileDirectory (() => FullPath);
- string path = Path.IsPathRooted (import.Project) ? import.Project : dir != null ? Path.Combine (dir, import.Project) : Path.GetFullPath (import.Project);
+ string path = ExpandString (import.Project);
+ path = Path.IsPathRooted (path) ? path : dir != null ? Path.Combine (dir, path) : Path.GetFullPath (path);
if (ProjectCollection.OngoingImports.Contains (path)) {
switch (load_settings) {
case ProjectLoadSettings.RejectCircularImports:
- throw new InvalidProjectFileException (import.Location, null, string.Format ("Circular imports was detected: {0} is already on \"importing\" stack", path));
+ throw new InvalidProjectFileException (import.Location, null, string.Format ("Circular imports was detected: {0} (resolved as \"{1}\") is already on \"importing\" stack", import.Project, path));
}
return new ProjectElement [0]; // do not import circular references
}
ProjectCollection.OngoingImports.Push (path);
try {
- using (var reader = XmlReader.Create (path)) {
+ using (var reader = XmlReader.Create (WindowsCompatibilityExtensions.NormalizeFilePath (path))) {
var root = ProjectRootElement.Create (reader, ProjectCollection);
raw_imports.Add (new ResolvedImport (import, root, true));
return this.EvaluatePropertiesAndImports (root.Children).ToArray ();
[MonoTODO]
public bool IsBuildEnabled { get; set; }
+ internal string BuildStartupDirectory { get; set; }
+
Stack<string> ongoing_imports = new Stack<string> ();
internal Stack<string> OngoingImports {
// FIXME: add MSBuildProgramFiles32
yield return create ("MSBuildProjectDefaultTargets", () => project.DefaultTargets);
yield return create ("MSBuildProjectDirectory", () => project.DirectoryPath + Path.DirectorySeparatorChar);
- // FIXME: add MSBuildProjectDirectoryNoRoot
+ yield return create ("MSBuildProjectDirectoryNoRoot", () => project.DirectoryPath.Substring (Path.GetPathRoot (project.DirectoryPath).Length));
yield return create ("MSBuildProjectExtension", () => Path.GetExtension (project.FullPath));
yield return create ("MSBuildProjectFile", () => Path.GetFileName (project.FullPath));
yield return create ("MSBuildProjectFullPath", () => project.FullPath);
yield return create ("MSBuildProjectName", () => Path.GetFileNameWithoutExtension (project.FullPath));
- // FIXME: add MSBuildStartupDirectory
+ yield return create ("MSBuildStartupDirectory", () => BuildStartupDirectory);
yield return create ("MSBuildThisFile", () => Path.GetFileName (GetEvaluationTimeThisFile (projectFullPath)));
yield return create ("MSBuildThisFileFullPath", () => GetEvaluationTimeThisFile (projectFullPath));
yield return create ("MSBuildThisFileName", () => Path.GetFileNameWithoutExtension (GetEvaluationTimeThisFile (projectFullPath)));
string dir = GetEvaluationTimeThisFileDirectory (projectFullPath) + Path.DirectorySeparatorChar;
return dir.Substring (Path.GetPathRoot (dir).Length);
});
+ yield return create ("MSBuildToolsPath", () => toolset.ToolsPath);
+ yield return create ("MSBuildToolsVersion", () => toolset.ToolsVersion);
}
// These are required for reserved property, represents dynamically changing property values.
--- /dev/null
+//
+// WindowsCompatibilityExtensions.cs
+//
+// Author:
+// Atsushi Enomoto (atsushi@xamarin.com)
+//
+// (C) 2013 Xamarin Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+using System;
+using System.IO;
+
+namespace Microsoft.Build.Internal
+{
+ public static class WindowsCompatibilityExtensions
+ {
+ public static string NormalizeFilePath (string path)
+ {
+ return path.Replace ('\\', Path.DirectorySeparatorChar);
+ }
+ }
+}
+
Microsoft.Build.Internal/FilteredEnumerable.cs
Microsoft.Build.Internal/ProjectTaskItem.cs
Microsoft.Build.Internal/ReverseEnumerable.cs
+Microsoft.Build.Internal/WindowsCompatibilityExtensions.cs
Microsoft.Build.Logging/ConfigurableForwardingLogger.cs
Microsoft.Build.Logging/ForwardingLoggerRecord.cs
Microsoft.Build.Logging/LoggerDescription.cs
}
[Test]
- [Category ("NotWorking")]
public void BuildCSharpTargetGetFrameworkPaths ()
{
string project_xml = @"<Project xmlns='http://schemas.microsoft.com/developer/msbuild/2003'>