diff options
-rw-r--r-- | mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Import.cs | 59 | ||||
-rw-r--r-- | mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Project.cs | 7 |
2 files changed, 38 insertions, 28 deletions
diff --git a/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Import.cs b/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Import.cs index 79893411b88..3b4ae86f0d8 100644 --- a/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Import.cs +++ b/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Import.cs @@ -163,40 +163,45 @@ namespace Microsoft.Build.BuildEngine { IEnumerable<string> extn_paths = has_extn_ref ? GetExtensionPaths (project) : new string [] {null}; bool import_needed = false; + var currentLoadSettings = project.ProjectLoadSettings; try { - foreach (string path in extn_paths) { - string extn_msg = null; - if (has_extn_ref) { - project.SetExtensionsPathProperties (path); - extn_msg = "from extension path " + path; - } + foreach (var settings in new ProjectLoadSettings [] { ProjectLoadSettings.None, currentLoadSettings}) { + foreach (string path in extn_paths) { + string extn_msg = null; + if (has_extn_ref) { + project.SetExtensionsPathProperties (path); + extn_msg = "from extension path " + path; + } - // do this after setting new Extension properties, as condition might - // reference it - if (!ConditionParser.ParseAndEvaluate (condition_attribute, project)) - continue; - - import_needed = true; - - // We stop if atleast one file got imported. - // Remaining extension paths are *not* tried - bool atleast_one = false; - foreach (string importPath in GetImportPathsFromString (project_attribute, project, base_dir_info)) { - try { - if (func (importPath, extn_msg)) - atleast_one = true; - } catch (Exception e) { - throw new InvalidProjectFileException (String.Format ( - "{0}: Project file could not be imported, it was being imported by " + - "{1}: {2}", importPath, importingFile, e.Message), e); + // do this after setting new Extension properties, as condition might + // reference it + if (!ConditionParser.ParseAndEvaluate (condition_attribute, project)) + continue; + + import_needed = true; + project.ProjectLoadSettings = settings; + + // We stop if atleast one file got imported. + // Remaining extension paths are *not* tried + bool atleast_one = false; + foreach (string importPath in GetImportPathsFromString (project_attribute, project, base_dir_info)) { + try { + if (func (importPath, extn_msg)) + atleast_one = true; + } catch (Exception e) { + throw new InvalidProjectFileException (String.Format ( + "{0}: Project file could not be imported, it was being imported by " + + "{1}: {2}", importPath, importingFile, e.Message), e); + } } - } - if (atleast_one) - return; + if (atleast_one) + return; + } } } finally { + project.ProjectLoadSettings = currentLoadSettings; if (has_extn_ref) project.SetExtensionsPathProperties (Project.DefaultExtensionsPath); } diff --git a/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Project.cs b/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Project.cs index 3ef00f121d3..4c9bf0a8e56 100644 --- a/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Project.cs +++ b/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Project.cs @@ -1560,7 +1560,7 @@ namespace Microsoft.Build.BuildEngine { return xmlDocument != null && xmlDocument.DocumentElement.HasAttribute ("ToolsVersion"); } } - + public string ToolsVersion { get; internal set; } @@ -1569,6 +1569,11 @@ namespace Microsoft.Build.BuildEngine { get { return last_item_group_containing; } } + internal ProjectLoadSettings ProjectLoadSettings { + get { return project_load_settings; } + set { project_load_settings = value; } + } + internal static XmlNamespaceManager XmlNamespaceManager { get { if (manager == null) { |