diff --git a/tests/xharness/ProjectFileExtensions.cs b/tests/xharness/ProjectFileExtensions.cs index 32ee40e93b68..d8c804ae139a 100644 --- a/tests/xharness/ProjectFileExtensions.cs +++ b/tests/xharness/ProjectFileExtensions.cs @@ -191,8 +191,7 @@ public static void SetIntermediateOutputPath (this XmlDocument csproj, string va return; // Make sure there's a top-level version too. - var project = csproj.ChildNodes [1]; - var property_group = project.ChildNodes [0]; + var property_group = csproj.SelectSingleNode("/*/*[local-name() = 'PropertyGroup' and not(@Condition)]"); var intermediateOutputPath = csproj.CreateElement ("IntermediateOutputPath", MSBuild_Namespace); intermediateOutputPath.InnerText = value;