Skip to content

Release builds map the repository folder to a neutral prefix, so a package does not embed the build machine's folders - #134

Merged
electricessence merged 1 commit into
masterfrom
build/deterministic-source-paths
Nov 12, 2026
Merged

electricessence merged 1 commit into
masterfrom
build/deterministic-source-paths

Conversation

@electricessence

@electricessence electricessence commented Nov 12, 2026 •

Copy link
Copy Markdown
Collaborator

Release builds map the repository folder to a neutral prefix, so a package does not embed the build machine's folders.

The problem

  • A dll built on a developer machine embeds the full path of the folder it was built in (the debug-symbol path in its debug directory), and the debug symbols embed the same folder in the Source Link mapping. A package built and packed locally therefore carries that machine's folder names to everyone who downloads it.

What changes

  • Source/Directory.Build.props: in a Release build, DeterministicSourcePaths is true. The SDK then maps the repository root to a neutral prefix in every path it embeds: the source files, the symbol path inside each dll, and the Source Link mapping. Debug builds are unchanged, so local debugging still finds the sources.
  • whats-new-11.md has an entry. No code changes.

Checked on the package

  • dotnet pack of Core in Release: the four dlls in the .nupkg and the four .pdb files in the .snupkg contain neither the build folder nor its drive path. The same pack without this setting embedded the build folder in the dlls and in the Source Link mapping. The other source projects share this props file.
  • A pack from a clean tree needs a build first (dotnet build, then dotnet pack --no-build); a pack that has to build from scratch fails in this repository with NU5026, with or without this change.

Checks

  • Gate on master's tip plus this change and the path change together, so far: Release and Debug builds 0 warnings, 0 errors. Tests: Debug 10193 of 10193 on net11.0 and on net10.0; Release net10.0 10193 of 10193; Release net11.0 10192 of 10193. The one failure is MappedQuerySelectTests.TheAsyncProjection_AllocatesNothingPerRow (a test from Select on IMappedQuery<T> composes a projection without running the query (query factories) #124): it fails on net11.0 in Release only, in this run and in an earlier one, and passes everywhere else; it is being investigated and does not involve this change. Samples: 117 of 117 pass. Style and analyzers: 0 findings. DocFX: 0 warnings. Visual Studio 2026's MSBuild on the whole solution (Debug): 0 errors.

🤖 Generated with Claude Code

…ckage does not embed the build machine's folders

In a Release build the SDK now maps the repository root (DeterministicSourcePaths) in every path it embeds: the
source files, the debug-symbol path inside each dll, and the Source Link mapping inside the symbols. A package
built on a developer machine no longer carries that machine's folder names. Debug builds are unchanged, so local
debugging still finds the sources.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@electricessence
electricessence merged commit 9b8d206 into master Nov 12, 2026
1 check passed
@electricessence
electricessence deleted the build/deterministic-source-paths branch November 12, 2026 16:23
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