Skip to content

Fix ILLink.Tasks output path in source-only builds - #132484

Merged
akoeplinger merged 1 commit into
dotnet:mainfrom
akoeplinger:fix-illink-sourceonly-outputpath
Aug 18, 2026
Merged

Fix ILLink.Tasks output path in source-only builds#132484
akoeplinger merged 1 commit into
dotnet:mainfrom
akoeplinger:fix-illink-sourceonly-outputpath

Conversation

@akoeplinger

Copy link
Copy Markdown
Member

ILLink.Tasks multi-targets $(NetCoreAppToolCurrent);$(NetFrameworkToolCurrent) and
rewrites OutputPath/IntermediateOutputPath into net\ / netframework\ subfolders
so the build output mirrors the NuGet package layout.

In a source-only build (/p:DotNetBuildSourceOnly=true), Directory.Build.props blanks
NetFrameworkToolCurrent so that only the .NET Core TFM is built. But the
netframework conditions compare against $(TargetFramework), which is also empty
during the outer (TFM-dispatching) build. '' == '' evaluates to true, so the outer
build's paths incorrectly picked up a netframework suffix:

before after
outer, normal build artifacts/bin/ILLink.Tasks/Debug/ unchanged
outer, source-only artifacts/bin/ILLink.Tasks/Debug/netframework/ artifacts/bin/ILLink.Tasks/Debug/
inner net11.0 .../Debug/net/ unchanged
inner net472 .../Debug/netframework/ unchanged

Guard both conditions on NetFrameworkToolCurrent being non-empty. This matches the fix
already applied to the mono task projects in #132402.

This is latent today — no consumer reads the outer $(OutputPath) (they all hardcode the
net subfolder) — but it's a trap for anything that adds such a consumer later, e.g. a
GetFilesToPackage-style target.

Note

This PR description was generated by GitHub Copilot.

NetFrameworkToolCurrent is blanked in source-only builds, so the empty
TargetFramework of the outer build matched the netframework condition and
the outer OutputPath/IntermediateOutputPath wrongly got a "netframework"
suffix. Guard the conditions on NetFrameworkToolCurrent being non-empty,
matching what the mono task projects already do.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 50cbbd7b-5246-4157-959c-0f92990d8f73
Copilot AI lite review requested due to automatic review settings August 18, 2026 19:23
@akoeplinger
akoeplinger requested a review from sbomer as a code owner August 18, 2026 19:23
@dotnet-policy-service dotnet-policy-service Bot added the linkable-framework Issues associated with delivering a linker friendly framework label Aug 18, 2026
@github-actions github-actions Bot added the area-Tools-ILLink .NET linker development as well as trimming analyzers label Aug 18, 2026
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).
13 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @agocke, @dotnet/illink
See info in area-owners.md if you want to be subscribed.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes ILLink.Tasks output/intermediate path rewriting so that source-only outer builds no longer incorrectly append a netframework\ suffix when $(NetFrameworkToolCurrent) is blank (matching the guard already applied in #132402).

Changes:

  • Guard the netframework OutputPath rewrite on $(NetFrameworkToolCurrent) being non-empty.
  • Guard the netframework IntermediateOutputPath rewrite on $(NetFrameworkToolCurrent) being non-empty.

@akoeplinger
akoeplinger merged commit 9cc9f09 into dotnet:main Aug 18, 2026
94 checks passed
@akoeplinger
akoeplinger deleted the fix-illink-sourceonly-outputpath branch August 18, 2026 22:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-Tools-ILLink .NET linker development as well as trimming analyzers linkable-framework Issues associated with delivering a linker friendly framework

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants