From 73f668537e00f81e3d81370bbf3496ef951395cd Mon Sep 17 00:00:00 2001 From: Dean Ellis Date: Tue, 19 Sep 2017 10:30:17 +0100 Subject: [PATCH] [Xamarin.Android.Build.Tasks] PackageReference and AndroidUseLatestPlatformSdk do not work together Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=59534 When using `PackageReference` with our system it run before `_SetLatestTargetFrameworkVersion`. As a result it always uses a `$(TargetFrameworkVersion)` of v2.3 or what ever the user defined in the project manually. So we need to make sure that `_SetLatestTargetFrameworkVersion` runs as part of the `PackageReference` target chain. Fortunately that chain is run as part of `ResolveAssemblyReferencesDependsOn`. So we just need to make sure that our target in run as part of that target chain in order to fix this issue. We also need to update a few NuGet specific properties to ensure that it uses the correct `TargetPlatformMoniker`. --- .../Xamarin.Android.Common.targets | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets b/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets index 769b8486974..879ed8e9b49 100755 --- a/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets +++ b/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets @@ -141,6 +141,10 @@ Copyright (C) 2011-2012 Xamarin. All rights reserved. --> + + _SetLatestTargetFrameworkVersion; + $(ResolveNuGetPackageAssetsDependsOn) + _SetLatestTargetFrameworkVersion; $(GetReferenceAssemblyPathsDependsOn) @@ -171,6 +175,7 @@ Copyright (C) 2011-2012 Xamarin. All rights reserved. <_XASupportsFastDev Condition=" Exists ('$(MSBuildThisFileDirectory)Xamarin.Android.Common.Debugging.targets') ">True <_XASupportsFastDev Condition=" '$(_XASupportsFastDev)' == '' ">False false + False False True False @@ -190,7 +195,6 @@ Copyright (C) 2011-2012 Xamarin. All rights reserved. Normal True False - False False + + + + +