From 7dddfb657cc734251b87af72912b39d3a9b7ace1 Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Fri, 17 May 2019 09:12:05 -0700 Subject: [PATCH] [xibuild] Fix incorrect mscorlib.dll being used (#6068) * [xibuild] Fix incorrect mscorlib.dll being used The `GuiUnit_NET_4_5` project, when built with `xibuild` uses the wrong `mscorlib.dll`. From https://github.com/xamarin/xamarin-macios/issues/5760#issuecomment-472457202 : ``` - mscorlib.dll is being used from mono/4.5 and the other system assemblies are from mono/4.5-api - GuiNet* project is built with xibuild What is happening here is: xibuild sets[1] `SetToolsetProperty ("TargetFrameworkRootPath", FrameworksDirectory + Path.DirectorySeparatorChar);` which points to `/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/xbuild-frameworks`. This causes $(FrameworkPathOverride) to be set[2] to `/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/xbuild-frameworks/.NETFramework/v4.5`, but that doesn't have a mscorlib.dll, so it gets reset[3] to /Library/Frameworks/Mono.framework/Versions/5.22.0/lib/mono/4.5/. If we don't set TargetFrameworkRoothPath, then we get `FrameworkPathOverride = /Library/Frameworks/Mono.framework/Versions/5.22.0/lib/mono/4.5-api`, causing `_ExplicitReference=/Library/Frameworks/Mono.framework/Versions/5.22.0/lib/mono/4.5-api/mscorlib.dll`(correct one) to be used. ``` Fixes https://github.com/xamarin/xamarin-macios/issues/5760 1. https://github.com/xamarin/xamarin-macios/blob/master/tools/xibuild/Main.cs#L209 2. https://github.com/mono/msbuild/blob/xplat-master/src/Tasks/Microsoft.Common.CurrentVersion.targets#L79 3. https://github.com/mono/msbuild/blob/xplat-master/src/Tasks/Microsoft.Common.CurrentVersion.targets#L84 * Revert "Workaround https://github.com/xamarin/xamarin-macios/issues/5760 in generator csproj" This reverts commit 9bd927bb7fe3eb1b14721745c500ff8b4aecd109. The previous commit for xibuild removes the need for this. --- src/generator.csproj | 1 - tests/generator/generator-tests.csproj | 1 - tools/xibuild/Main.cs | 1 - 3 files changed, 3 deletions(-) diff --git a/src/generator.csproj b/src/generator.csproj index cb53b0c72d..3753f9a866 100644 --- a/src/generator.csproj +++ b/src/generator.csproj @@ -23,7 +23,6 @@ True - diff --git a/tests/generator/generator-tests.csproj b/tests/generator/generator-tests.csproj index cda6de8d9f..9a606239c8 100644 --- a/tests/generator/generator-tests.csproj +++ b/tests/generator/generator-tests.csproj @@ -26,7 +26,6 @@ 4 - diff --git a/tools/xibuild/Main.cs b/tools/xibuild/Main.cs index 55111a7fce..f0fefc157f 100644 --- a/tools/xibuild/Main.cs +++ b/tools/xibuild/Main.cs @@ -206,7 +206,6 @@ namespace xibuild { SetToolsetProperty ("MSBuildExtensionsPath32", MSBuildExtensionsPath); SetToolsetProperty ("MSBuildExtensionsPath64", MSBuildExtensionsPath); SetToolsetProperty ("RoslynTargetsPath", Path.Combine (MSBuildBin, "Roslyn")); - SetToolsetProperty ("TargetFrameworkRootPath", FrameworksDirectory + Path.DirectorySeparatorChar); //NOTE: Must include trailing \ SetToolsetProperty ("MSBuildSdksPath", MSBuildSdksPath); dstXml.Save (targetConfigFile);