diff --git a/eng/build.ps1 b/eng/build.ps1 index 9086c7de7bce7..300b675bad461 100644 --- a/eng/build.ps1 +++ b/eng/build.ps1 @@ -711,11 +711,6 @@ try { exit 1 } - $regKeyProperty = Get-ItemProperty -Path HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem -Name "LongPathsEnabled" -ErrorAction Ignore - if (($null -eq $regKeyProperty) -or ($regKeyProperty.LongPathsEnabled -ne 1)) { - Write-Host "LongPath is not enabled, you may experience build errors. You can avoid these by enabling LongPath with `"reg ADD HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem /v LongPathsEnabled /t REG_DWORD /d 1`"" - } - Process-Arguments . (Join-Path $PSScriptRoot "build-utils.ps1") diff --git a/eng/enable-long-paths.reg b/eng/enable-long-paths.reg new file mode 100644 index 0000000000000..a49f4aae6c1fa --- /dev/null +++ b/eng/enable-long-paths.reg @@ -0,0 +1,4 @@ +Windows Registry Editor Version 5.00 + +[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem] +"LongPathsEnabled"=dword:00000001 diff --git a/eng/targets/Imports.targets b/eng/targets/Imports.targets index 0cb7758b747c0..4da62950a42f5 100644 --- a/eng/targets/Imports.targets +++ b/eng/targets/Imports.targets @@ -154,6 +154,14 @@ Condition="$(_VersionComparisonResult) < 0"/> + + + <_RoslynLongPathsEnabled>$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\FileSystem', 'LongPathsEnabled', null, RegistryView.Registry64, RegistryView.Registry32)) + + + + +