Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions eng/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,29 @@ function Get-Help() {
Write-Host "For more information, check out https://github.com/dotnet/runtime/blob/main/docs/workflow/README.md"
}

function Check-LongPathSupport() {
$regValue = Get-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem" -Name "LongPathsEnabled" -ErrorAction SilentlyContinue

if ($regValue -and $regValue.LongPathsEnabled -eq 1) {
return
}

Write-Host ""
Write-Host "ERROR: Long file paths are not enabled on this system." -ForegroundColor Red
Write-Host "The dotnet/runtime repository requires long path support to build successfully." -ForegroundColor Red
Write-Host ""
Write-Host "Please follow the instructions at:" -ForegroundColor Yellow
Write-Host " docs\workflow\requirements\windows-requirements.md#enable-long-paths" -ForegroundColor Yellow
Write-Host ""
Write-Host "Quick fix:" -ForegroundColor Yellow
Write-Host " 1. Enable long paths in Windows (requires admin):" -ForegroundColor White
Write-Host " https://learn.microsoft.com/windows/win32/fileio/maximum-file-path-limitation" -ForegroundColor White
Write-Host " 2. Enable long paths in Git:" -ForegroundColor White
Write-Host " git config --system core.longpaths true" -ForegroundColor White
Write-Host ""
exit 1
}

if ($help) {
Get-Help
exit 0
Expand All @@ -152,6 +175,8 @@ if ($subset -eq 'help') {
exit 0
}

Check-LongPathSupport

# Lower-case the passed in OS string.
if ($os) {
$os = $os.ToLowerInvariant()
Expand Down
Loading