Skip to content

Commit

Permalink
[xibuild] Handle "incorrectly" cased msbuild property names (xamarin#…
Browse files Browse the repository at this point in the history
…6202)

msbuild property names are case insensitive. While generating the custom
app.config, in `SetToolsetProperty(..)` we try to update the property if
it already exists. But the name lookup was case sensitive, thus causing
the lookup to fail, resulting in two entries for the same property name
differing only in case. Eg. `MSBuildSDKsPath` vs `MSBuildSdksPath`.

Fixed to ignore case.

Fixes mono/mono#14765 .
  • Loading branch information
radical authored and spouliot committed Jun 4, 2019
1 parent 7d67e05 commit 55c4073
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions tools/xibuild/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ static void GenerateAppConfig (string targetConfigFile, string baseConfigFile)
SetToolsetProperty ("MSBuildExtensionsPath32", MSBuildExtensionsPath);
SetToolsetProperty ("MSBuildExtensionsPath64", MSBuildExtensionsPath);
SetToolsetProperty ("RoslynTargetsPath", Path.Combine (MSBuildBin, "Roslyn"));
SetToolsetProperty ("MSBuildSdksPath", MSBuildSdksPath);
SetToolsetProperty ("MSBuildSDKsPath", MSBuildSdksPath);

dstXml.Save (targetConfigFile);
return;
Expand All @@ -228,7 +228,8 @@ void SetToolsetProperty (string name, string value)
if (string.IsNullOrEmpty (value))
return;

var valueAttribute = toolsets.SelectSingleNode ($"property[@name='{name}']/@value");
// MSBuild property names are case insensitive
var valueAttribute = toolsets.SelectSingleNode ($"property[translate(@name, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz')='{name.ToLowerInvariant()}']/@value");
if (valueAttribute != null) {
valueAttribute.Value = value;
} else {
Expand Down

0 comments on commit 55c4073

Please sign in to comment.