[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 9bd927bb7f.

The previous commit for xibuild removes the need for this.
This commit is contained in:
Ankit Jain 2019-05-17 09:12:05 -07:00 коммит произвёл Rolf Bjarne Kvinge
Родитель d84c3a0892
Коммит 7dddfb657c
3 изменённых файлов: 0 добавлений и 3 удалений

Просмотреть файл

@ -23,7 +23,6 @@
<Deterministic>True</Deterministic>
</PropertyGroup>
<ItemGroup>
<Reference Include="mscorlib" />
<Reference Include="System" />
<Reference Include="System.Core" />
</ItemGroup>

Просмотреть файл

@ -26,7 +26,6 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="mscorlib" />
<Reference Include="System" />
<Reference Include="System.Xml" />
<Reference Include="nunit.framework">

Просмотреть файл

@ -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);