diff options
author | Lluis Sanchez Gual <lluis@xamarin.com> | 2015-05-20 19:13:31 +0300 |
---|---|---|
committer | Lluis Sanchez Gual <lluis@xamarin.com> | 2015-05-20 19:13:58 +0300 |
commit | d2acffe2324732d14959ef745ccea403f8e7c084 (patch) | |
tree | 1b511f642303579024640691ab52b59ec7e17f48 /main/src/core/MonoDevelop.Projects.Formats.MSBuild | |
parent | 4f512f5cfb14a421b9ae6ed8dcfd9906ee2c7471 (diff) |
[Core] Fix target evaluation with custom properties
Diffstat (limited to 'main/src/core/MonoDevelop.Projects.Formats.MSBuild')
2 files changed, 15 insertions, 1 deletions
diff --git a/main/src/core/MonoDevelop.Projects.Formats.MSBuild/MonoDevelop.Projects.Formats.MSBuild/ProjectBuilder.cs b/main/src/core/MonoDevelop.Projects.Formats.MSBuild/MonoDevelop.Projects.Formats.MSBuild/ProjectBuilder.cs index 3ad60ebaa6..30f1b130ec 100644 --- a/main/src/core/MonoDevelop.Projects.Formats.MSBuild/MonoDevelop.Projects.Formats.MSBuild/ProjectBuilder.cs +++ b/main/src/core/MonoDevelop.Projects.Formats.MSBuild/MonoDevelop.Projects.Formats.MSBuild/ProjectBuilder.cs @@ -79,9 +79,19 @@ namespace MonoDevelop.Projects.Formats.MSBuild } if (runTargets != null && runTargets.Length > 0) { + if (globalProperties != null) { + foreach (var p in globalProperties) + project.GlobalProperties.SetProperty (p.Key, p.Value); + } + // We are using this BuildProject overload and the BuildSettings.None argument as a workaround to // an xbuild bug which causes references to not be resolved after the project has been built once. buildEngine.Engine.BuildProject (project, runTargets, new Hashtable (), BuildSettings.None); + + if (globalProperties != null) { + foreach (var p in globalProperties.Keys) + project.GlobalProperties.RemoveProperty (p); + } } result = new MSBuildResult (logger.BuildResult.ToArray ()); diff --git a/main/src/core/MonoDevelop.Projects.Formats.MSBuild/MonoDevelop.Projects.Formats.MSBuild/ProjectBuilder.v4.0.cs b/main/src/core/MonoDevelop.Projects.Formats.MSBuild/MonoDevelop.Projects.Formats.MSBuild/ProjectBuilder.v4.0.cs index b054a94e7f..8dc1ded9e7 100644 --- a/main/src/core/MonoDevelop.Projects.Formats.MSBuild/MonoDevelop.Projects.Formats.MSBuild/ProjectBuilder.v4.0.cs +++ b/main/src/core/MonoDevelop.Projects.Formats.MSBuild/MonoDevelop.Projects.Formats.MSBuild/ProjectBuilder.v4.0.cs @@ -79,7 +79,11 @@ namespace MonoDevelop.Projects.Formats.MSBuild //building the project will create items and alter properties, so we use a new instance
var pi = project.CreateProjectInstance (); - +
+ if (globalProperties != null)
+ foreach (var p in globalProperties)
+ pi.SetProperty (p.Key, p.Value);
+
pi.Build (runTargets, loggers); result = new MSBuildResult (logger.BuildResult.ToArray ()); |