Repository navigation
Work around MSVC path limits in Windows CoreCLR builds - #137259
Merged
Merged
Conversation
Co-authored-by: Copilot App <[email protected]>
|
Azure Pipelines: Successfully started running 4 pipeline(s). 11 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
|
Tagging subscribers to this area: @dotnet/runtime-infrastructure |
3 tasks
Remove the target-OS gate and the documentation paragraph per review. Co-authored-by: Copilot App <[email protected]>
jkoritzinsky
approved these changes
Nov 18, 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.
Note
This change and PR description were prepared with assistance from GitHub Copilot.
Problem
I've been hitting Windows build failures when using the Copilot app, which creates isolated worktrees under paths like:
This is a normal app-generated checkout path, but adding the native build directories and target names produces object paths longer than MSVC can handle. In this case, a NativeAOT descriptor object path reaches 266 characters and
cl.exefails with:Windows long paths were already enabled. The compiler still rejects this output path, and adding a
\\?\prefix does not help.Workaround
For Windows-target CoreCLR builds using Ninja, use the existing Windows 8.3 spelling of the intermediate directory as Ninja's working directory. Pass it through
cmake --buildusing Ninja's-Coption, since passing the alias to CMake alone expands it back to the long path.This keeps the existing targets, output locations, compiler settings and CMake parallelism settings. It does not create aliases, change filesystem settings or add drive mappings.
The common scenario this addresses is building from a nested checkout such as a Copilot app worktree on a Windows volume where short aliases are available. It is not unrestricted long-path support: NTFS aliases are not guaranteed, ReFS does not provide them, and sufficiently long paths may still require a shorter checkout. The Windows build documentation now explains those limits.
Validation
Windows x64, using the default Ninja build:
.\build.cmd clr+libs -rc Releasefailed with the C1083 error above..\build.cmd clr+libs -rc Releasepassed with zero MSBuild warnings or errors. All nine NativeAOT descriptor objects were deleted before this run and rebuilt; this was not another entirely clean checkout build.git diff --checkpassed.Related to #110407 and #60812. This targets CoreCLR's Windows Ninja build and does not resolve every scenario in those issues.