Simplify ILLink/ILC root assembly handling: TrimmerRootAssembly assembly names only#125365
Draft
Simplify ILLink/ILC root assembly handling: TrimmerRootAssembly assembly names only#125365
Conversation
…nly support assembly names Co-authored-by: sbomer <787361+sbomer@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Simplify illink root assembly handling to support assembly names only
Simplify illink root assembly handling: TrimmerRootAssembly assembly names only
Mar 10, 2026
… names only Co-authored-by: sbomer <787361+sbomer@users.noreply.github.com>
Copilot
AI
changed the title
Simplify illink root assembly handling: TrimmerRootAssembly assembly names only
Simplify ILLink/ILC root assembly handling: TrimmerRootAssembly assembly names only
Mar 10, 2026
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
TrimmerRootAssemblyitems and the illink-aflag previously accepted file paths, creating an MSBuild incremental build gap: illink could read files not declared as build inputs. This aligns both ILLink and ILC to accept only assembly names.Description
ILLink command-line (
-aflag)Driver.cs: RemoveFile.Exists()pre-check;-anow accepts assembly names onlyRootAssemblyInputStep.cs: RemoveFile.Exists()loading path ("quirks mode"); renameLoadAssemblyFile()→LoadAssemblyByName(), resolve exclusively viaContext.TryResolve()MSBuild targets
Microsoft.NET.ILLink.targets: PopulateTrimmerRootAssemblywith@(IntermediateAssembly->'%(Filename)')(name, no extension) instead of the full item pathMicrosoft.NETCore.Native.targets: Remove complex two-step_Raw+System.IO.File::Exists()pattern that converted paths to names;TrimmerRootAssemblyis now used directly as assembly names;ManagedAssemblyToLinkstill uses%(Filename)since it contains file pathsBrowserWasmApp.targets: Update condition to compare%(Identity)against$(AssemblyName)instead of@(IntermediateAssembly)AppleBuild.LocalBuild.targets: Use%(AppleAssembliesToBundle.FileName)(no extension) instead of%(Identity)(full path)Test infrastructure
TrimmingArgumentBuilder.cs: Strip extension viaPath.GetFileNameWithoutExtension()when building-aargumentsTestCaseMetadataProvider.cs: Move relative-path expansion from-ato-d(search directory arguments);-avalues are now passed through as-is[SetupLinkerArgument("-a", ...)]RootLibraryVisibleForwardersWithoutReference.cs: Add explicit[SetupLinkerArgument("-d", "isolated")]search path so the subdirectory assembly remains findable by nameCustomer Impact
No direct customer impact; this is an internal build/tooling correctness fix. Users who were passing file paths to
TrimmerRootAssembly(undocumented usage) will need to switch to assembly names.Regression
No — this is a proactive correctness fix, not a regression fix.
Testing
All 377 affected ILLink test cases pass (
Mono.Linker.Tests). All 108ILLink.Tasks.Testspass.Risk
Low. The change is contained to ILLink/ILC build integration and test infrastructure. The linker's assembly resolution behavior is unchanged — only the file-path loading shortcut is removed. MSBuild targets now pass assembly names consistently, which is what downstream tools (ILC) already required.
Package authoring no longer needed in .NET 9
IMPORTANT: Starting with .NET 9, you no longer need to edit a NuGet package's csproj to enable building and bump the version.
Keep in mind that we still need package authoring in .NET 8 and older versions.
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.