* Main.cs (Execute): Build the project/sln with current directory set to
authorAnkit Jain <radical@corewars.org>
Fri, 13 Mar 2009 09:32:37 +0000 (09:32 -0000)
committerAnkit Jain <radical@corewars.org>
Fri, 13 Mar 2009 09:32:37 +0000 (09:32 -0000)
the project file's dir.
* SolutionParser.cs (ParseSolution): Project paths are relative to
solution directory.

svn path=/trunk/mcs/; revision=129251

mcs/tools/xbuild/ChangeLog
mcs/tools/xbuild/Main.cs
mcs/tools/xbuild/SolutionParser.cs

index 7d5d6d62550efa9623c066ef53348c9849cef2d8..01ef0e975d989e2bc1f04781b2e01bbba6f9066a 100644 (file)
@@ -1,3 +1,10 @@
+2009-03-13  Ankit Jain  <jankit@novell.com>
+
+       * Main.cs (Execute): Build the project/sln with current directory set to
+       the project file's dir.
+       * SolutionParser.cs (ParseSolution): Project paths are relative to
+       solution directory.
+
 2009-03-06  Ankit Jain  <jankit@novell.com>
 
        Fix bug #481336.
index e2bb69c17aa3c4f6b370fa1e71143c49b68bdff4..69ceec27ace12b56841a6fc67fb554bf55e99b99 100644 (file)
@@ -108,7 +108,10 @@ namespace Mono.XBuild.CommandLine {
 
                                project.Load (projectFile);
                                
+                               string oldCurrentDirectory = Environment.CurrentDirectory;
+                               Directory.SetCurrentDirectory (Path.GetDirectoryName (projectFile));
                                result = engine.BuildProject (project, parameters.Targets, null);
+                               Directory.SetCurrentDirectory (oldCurrentDirectory);
                        }
                        
                        catch (InvalidProjectFileException ipfe) {
index 8c212055a205bc73fa02d9b5bcbdc4c560525a8b..3a10101a98eed179af2d951f8b2142171b446a68 100644 (file)
@@ -93,6 +93,7 @@ namespace Mono.XBuild.CommandLine {
                        StreamReader reader = new StreamReader (file);
                        string line = reader.ReadToEnd ();
                        line = line.Replace ("\r\n", "\n");
+                       string solutionDir = Path.GetDirectoryName (file);
 
                        List<TargetInfo> solutionTargets = new List<TargetInfo> ();
                        Dictionary<Guid, ProjectInfo> projectInfos = new Dictionary<Guid, ProjectInfo> ();
@@ -110,7 +111,8 @@ namespace Mono.XBuild.CommandLine {
                                projectInfos.Add (new Guid (m.Groups[4].Value), projectInfo);
 
                                Project currentProject = p.ParentEngine.CreateNewProject ();
-                               currentProject.Load (projectInfo.FileName.Replace ('\\', Path.DirectorySeparatorChar));
+                               currentProject.Load (Path.Combine (solutionDir,
+                                                       projectInfo.FileName.Replace ('\\', Path.DirectorySeparatorChar)));
 
                                foreach (BuildItem bi in currentProject.GetEvaluatedItemsByName ("ProjectReference")) {
                                        string projectReferenceGuid = bi.GetEvaluatedMetadata ("Project");