diff --git a/src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.ILLink.targets b/src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.ILLink.targets
index 517f7e0ae49..5b2233562aa 100644
--- a/src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.ILLink.targets
+++ b/src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.ILLink.targets
@@ -13,55 +13,35 @@ This file contains the .NET 5-specific targets to customize ILLink
Condition=" '$(PublishTrimmed)' == 'true' "
AfterTargets="ComputeResolvedFilesToPublishList"
DependsOnTargets="GetReferenceAssemblyPaths;_CreatePropertiesCache">
+
+
+ <_TrimmerDefaultAction Condition=" '$(AndroidLinkMode)' == 'Full' ">link
+ <_TrimmerDumpDependencies Condition=" '$(LinkerDumpDependencies)' == 'true' ">true
+
+ <_ExtraTrimmerArgs>$(_ExtraTrimmerArgs) --verbose
+
-
-
link
-
-
-
-
-
- <_ExtraTrimmerArgs>$(_ExtraTrimmerArgs) --verbose --deterministic --custom-data XATargetFrameworkDirectories="$(_XATargetFrameworkDirectories)"
- <_AdditionalTaskAssemblyDirectory>$(XamarinSdkRootDirectory)tools/dotnet-linker/
- <_AdditionalTaskAssembly>$(_AdditionalTaskAssemblyDirectory)dotnet-linker.dll
-
-
- <_ExtraTrimmerArgs>$(_ExtraTrimmerArgs) --custom-data AddKeepAlivesStep="$(AndroidAddKeepAlives)"
-
-
- <_ExtraTrimmerArgs>$(_ExtraTrimmerArgs) --custom-data ProguardConfiguration="$(_ProguardProjectConfiguration)"
-
-
- <_ExtraTrimmerArgs>$(_ExtraTrimmerArgs) --custom-data AndroidLinkResources="$(AndroidLinkResources)"
-
-
- <_ExtraTrimmerArgs>--dump-dependencies $(_ExtraTrimmerArgs)"
-
-
+
+ <_TrimmerCustomData Include="XATargetFrameworkDirectories" Value="$(_XATargetFrameworkDirectories)" />
+ <_TrimmerCustomData Condition=" '$(AndroidAddKeepAlives)' != '' " Include="AddKeepAlivesStep" Value="$(AndroidAddKeepAlives)" />
+ <_TrimmerCustomData Condition=" '$(_ProguardProjectConfiguration)' != '' " Include="ProguardConfiguration" Value="$(_ProguardProjectConfiguration)" />
+ <_TrimmerCustomData Condition=" '$(AndroidLinkResources)' != '' " Include="AndroidLinkResources" Value="$(AndroidLinkResources)" />
+
<_TrimmerCustomSteps Include="$(MSBuildThisFileDirectory)..\tools\Microsoft.Android.Sdk.ILLink.dll">
MarkStep
Microsoft.Android.Sdk.ILLink.SetupStep
-
-
+
<_PreserveLists Include="$(MSBuildThisFileDirectory)..\PreserveLists\*.xml" />