Migrate GenerateProguardConfiguration from ILLink step to MSBuild task#10694
Merged
jonathanpeppers merged 8 commits intomainfrom Feb 13, 2026
Merged
Migrate GenerateProguardConfiguration from ILLink step to MSBuild task#10694jonathanpeppers merged 8 commits intomainfrom
jonathanpeppers merged 8 commits intomainfrom
Conversation
The new task runs AfterTargets="ILLink" and uses System.Reflection.Metadata instead of Mono.Cecil to scan linked assemblies.
grendello
reviewed
Jan 15, 2026
Member
Contributor
There was a problem hiding this comment.
Pull request overview
This PR migrates the GenerateProguardConfiguration functionality from an ILLink custom step (using Mono.Cecil) to an MSBuild task (using System.Reflection.Metadata). The task runs after the ILLink target and scans linked assemblies to generate ProGuard configuration rules for Android callable wrapper (ACW) types.
Changes:
- Added new MSBuild task
GenerateProguardConfigurationusing System.Reflection.Metadata for assembly inspection - Updated MSBuild targets to invoke the new task after ILLink instead of as a linker custom step
- Removed the old ILLink step implementation that used Mono.Cecil
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| src/Xamarin.Android.Build.Tasks/Tasks/GenerateProguardConfiguration.cs | New MSBuild task that scans linked assemblies for RegisterAttribute and generates ProGuard keep rules |
| src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.ILLink.targets | Added targets to prepare linked assemblies and invoke the new task; removed old linker custom step configuration |
| src/Microsoft.Android.Sdk.ILLink/GenerateProguardConfiguration.cs | Deleted old ILLink step implementation |
Member
Author
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
In NativeAOT builds, ResolvedFileToPublish is not populated until _AndroidComputeIlcCompileInputs runs (after ILLink), so the proguard generation targets were reading an empty assembly list and missing the entry-point assembly. This caused R8 to strip Java classes needed at runtime, resulting in ClassNotFoundException. Use a property-based AfterTargets approach: _GenerateProguardAfterTargets defaults to ILLink for the standard path, and NativeAOT.targets overrides it to _AndroidComputeIlcCompileInputs. Also switch from ManagedAssemblyToLink (which never includes the entry-point assembly) to ResolvedFileToPublish filtered to .dll, which correctly includes all assemblies in both paths.
# Conflicts: # src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.ILLink.targets
…ation.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…ation.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Member
Author
|
@jonathanpeppers I think this is ready to go, PTAL! |
jonathanpeppers
approved these changes
Feb 13, 2026
8 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

The new task runs AfterTargets="ILLink" and uses System.Reflection.Metadata instead of Mono.Cecil to scan linked assemblies.