Skip to content

Commit

Permalink
Fix netstd2 issue on XM full by expanding facades the same as Modern (x…
Browse files Browse the repository at this point in the history
…amarin#2731)

- https://bugzilla.xamarin.com/show_bug.cgi?id=59474
- The idea is to force Full and Modern to expand facades the same way. That way, we get the same, working behavior.
- f79f2e4 was not sufficient, even though it matched XI, because of the difference between XI (and Modern) and what Full was doing.
- Some context:

PR xamarin#2685

And that was problematic because it was expanding the netstandard facades from `Microsoft.NET.Build.Extensions`
in the `ImplicitlyExpandNETStandardFacades` target.
But we want to build against XM's bundled facades *only*. So we disable the ns facades completely
by setting `$(ImplicitlyExpandNETStandardFacades) = false`.

But now we are in the situation where a XM/Full project referencing a ns project might fail to build
because of a missing `netstandard.dll` reference! And this same case was fixed for XM/Modern projects in
xamarin#2643 . So, we enable the use of that for XM/Full projects too
through `Xamarin.Mac.msbuild.targets`.
  • Loading branch information
chamons committed Sep 25, 2017
1 parent b3aca49 commit bb74ca0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 17 deletions.
16 changes: 1 addition & 15 deletions msbuild/Xamarin.Mac.Tasks/Xamarin.Mac.Common.targets
Original file line number Diff line number Diff line change
Expand Up @@ -87,21 +87,7 @@ Copyright (C) 2014 Xamarin. All rights reserved.

<PropertyGroup Condition="'$(TargetFrameworkName)' == 'Full'">
<AssemblySearchPaths>$(XamarinMacFrameworkRoot)/lib/reference/full;$(XamarinMacFrameworkRoot)/lib/mono;$(AssemblySearchPaths)</AssemblySearchPaths>

<!--
This is to handle the case of XM/Full project referencing a netstandard project.
For XM/Full, $(TargetFrameworkDirectory) is `lib/mono/4.5` which has `netstandard.dll`.
This causes ImplicitlyExpandNETStandardFacades to skip expanding assuming that when ImplicitlyExpandDesignTimeFacades
expands the facades, `netstandard.dll` would get referenced too.
But if the XM project does NOT have any System.Runtime facades, then ImplicitlyExpandDesignTimeFacades will not expand
the facades and so we end up with no `netstandard.dll` reference!
With `$(NETStandardInbox) == false`, `ImplicitlyExpandNETStandardFacades` behaves as if `netstandard.dll` was not
available in the framework directories and will expand the facades if required.
-->
<NETStandardInbox Condition="'$(NETStandardInbox)' == ''">false</NETStandardInbox>
<ImplicitlyExpandNETStandardFacades>False</ImplicitlyExpandNETStandardFacades>
</PropertyGroup>

<!-- Do not resolve from the GAC in Modern or Full unless allow-unsafe-gac-resolution is passed in -->
Expand Down
3 changes: 1 addition & 2 deletions msbuild/Xamarin.Mac.Tasks/Xamarin.Mac.msbuild.targets
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,5 @@ Copyright (c) 2017 Microsoft Corp. (www.microsoft.com)
</ItemGroup>
</Target>

<!-- Modern/Mobile does not get ImplicitlyExpandDesignTimeFacades as Microsoft.NETFramework.CurrentVersion.targets isn't pulled in -->
<Import Project="$(MSBuildThisFileDirectory)Xamarin.Mac.Common.ImplicitFacade.msbuild.targets" Condition="'$(TargetFrameworkName)' == 'Modern'"/>
<Import Project="$(MSBuildThisFileDirectory)Xamarin.Mac.Common.ImplicitFacade.msbuild.targets" Condition="'$(TargetFrameworkName)' == 'Modern' Or '$(TargetFrameworkName)' == 'Full'"/>
</Project>

0 comments on commit bb74ca0

Please sign in to comment.