Skip to content

Commit

Permalink
[msbuild][mac] Fix regression in facade paths for Full/Modern projects (
Browse files Browse the repository at this point in the history
#2655)

Regression from:
----------------
commit e5d012c
Author: Chris Hamons <[email protected]>
Date:   Mon Aug 14 13:17:10 2017 -0500

[macos] System mono should resolve non-XM libraries from system (#2480)
----------------

The way this manifests is that for (eg.) a `TargetFrameworkName=Full` project,
after the `FixTargetFrameworkDirectory`(X.M.Common.targets) target we end up with
`$(TargetFrameworkDirectory)` having value of:

    /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/lib/mono/4.5
    /Library/Frameworks/Mono.framework/Versions/5.4.0/lib/mono/4.6.1-api/Facades/

.. and the second path is incorrect. It should have been:

    /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/lib/mono/4.5/Facades

This path fixup is done by `FixDesignTimeFacades` (X.M.msbuild.targets)
target, but this target is running *after*
`FixTargetFrameworkDirectory`, so it doesn't see the fixed facade path!

Both `FixTargetFrameworkDirectory` and `FixDesignTimeFacades` have
`AfterTargets="GetReferenceAssemblyPaths`. But since
`FixTargetFrameworkDirectory` is defined before the
`Xamarin.Mac.msbuild.targets` import, so it gets executed before
`FixDesignTimeFacades`.
  • Loading branch information
radical authored and spouliot committed Sep 13, 2017
1 parent a9e7a0d commit c7b2d78
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion msbuild/Xamarin.Mac.Tasks/Xamarin.Mac.Common.targets
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,10 @@ Copyright (C) 2014 Xamarin. All rights reserved.
<AssemblySearchPaths Condition="'$(MSBuildRuntimeVersion)' != ''">$(AssemblySearchPaths.Split(';'))</AssemblySearchPaths>
</PropertyGroup>

<Target Name="FixDesignTimeFacades" AfterTargets="GetReferenceAssemblyPaths" Condition="'$(OS)' != 'Windows_NT'" />

<!-- Location of Libraries -->
<Target Name="FixTargetFrameworkDirectory" AfterTargets="GetReferenceAssemblyPaths" Condition="('$(OS)' != 'Windows_NT')">
<Target Name="FixTargetFrameworkDirectory" AfterTargets="FixDesignTimeFacades" Condition="('$(OS)' != 'Windows_NT')">
<PropertyGroup>
<!-- For Modern / Full we overwrite TargetFrameworkDirectory to resolve non XM assemblies from our location only -->
<TargetFrameworkDirectory Condition="'$(TargetFrameworkName)' != 'System'">$(MacBclPath);@(DesignTimeFacadeDirectories)</TargetFrameworkDirectory>
Expand Down

0 comments on commit c7b2d78

Please sign in to comment.