Skip to content

Move StripEmbeddedLibraries to MSBuild task#10894

Draft
sbomer wants to merge 3 commits intomainfrom
dev/sbomer/stripembedded-innerbuild
Draft

Move StripEmbeddedLibraries to MSBuild task#10894
sbomer wants to merge 3 commits intomainfrom
dev/sbomer/stripembedded-innerbuild

Conversation

@sbomer
Copy link
Member

@sbomer sbomer commented Mar 5, 2026

(Trying as an alternative to #10695 that should have fewer build changes, and avoids stripping R2R info from assemblies.)

Move embedded resource stripping out of the ILLink custom step so it runs after ILLink but before ReadyToRun/crossgen2 in the inner build, ensuring R2R images are generated from already-stripped assemblies.

  • Trimmed builds: new StripEmbeddedLibraries MSBuild task runs via _StripEmbeddedLibraries target (AfterTargets="ILLink") in the inner build, processing assemblies in-place with temp-write-copy-back.
  • Non-trimmed builds: new StripEmbeddedLibrariesStep added to LinkAssembliesNoShrink pipeline.
  • Shared ShouldStripResource() logic between both paths.
  • Removed old _TrimmerCustomSteps registration and deleted the ILLink StripEmbeddedLibraries.cs (now dead code).

sbomer added 3 commits March 5, 2026 15:50
…one MSBuild task and pipeline step

Move embedded resource stripping out of the ILLink custom step so it
runs after ILLink but before ReadyToRun/crossgen2 in the inner build,
ensuring R2R images are generated from already-stripped assemblies.

- Trimmed builds: new StripEmbeddedLibraries MSBuild task runs via
  _StripEmbeddedLibraries target (AfterTargets="ILLink") in the inner
  build, processing assemblies in-place with temp-write-copy-back.
- Non-trimmed builds: new StripEmbeddedLibrariesStep added to
  LinkAssembliesNoShrink pipeline.
- Shared ShouldStripResource() logic between both paths.
- Removed old _TrimmerCustomSteps registration and deleted the ILLink
  StripEmbeddedLibraries.cs (now dead code).
…er with search directories

When Cecil writes a modified assembly, it resolves type references during
metadata building (MetadataBuilder.GetConstantType). Without an assembly
resolver configured with search directories, this fails with
AssemblyResolutionException for references like Mono.Android.

Add a DefaultAssemblyResolver populated with unique directories from the
assembly list, matching the pattern used by AssemblyModifierPipeline.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant