diff --git a/build.ps1 b/build.ps1
index cea9861d52b6dfcd870a6cbd026507711a8f215c..4ea50f51578c7f5a5facf51668ce5ea7f681985a 100644
--- a/build.ps1
+++ b/build.ps1
@@ -362,9 +362,10 @@ try {
 
     $toolsetBuildProj = InitializeToolset
 
-    $sdkPath = [IO.Path]::Combine($env:DOTNET_INSTALL_DIR, 'sdk', '3.1.102')
+    $dotnetInstallDir = Join-Path $RepoRoot ".dotnet"
+    $sdkPath = [IO.Path]::Combine($dotnetInstallDir, 'sdk', '3.1.102')
     if (!(Test-Path $sdkPath)) {
-        InstallDotNetSdk $env:DOTNET_INSTALL_DIR '3.1.102-servicing-014873' -skipNonVersionedFiles $true
+        InstallDotNetSdk $dotnetInstallDir '3.1.102-servicing-014873' -skipNonVersionedFiles $true
     }
 
     $restore = $tmpRestore
diff --git a/build.sh b/build.sh
index de95cda110883cff10c328b73df236daec767432..430a533f9ebda8e6341344ce72edf916ad78f7ba 100755
--- a/build.sh
+++ b/build.sh
@@ -316,7 +316,7 @@ restore=true
 
 InitializeToolset
 
-InstallDotNetSdk "$DOTNET_INSTALL_DIR" "3.1.102-servicing-014873"
+InstallDotNetSdk "$repo_root/.dotnet" "3.1.102-servicing-014873"
 
 restore=$_tmp_restore=