diff --git a/eng/common/build.ps1 b/eng/common/build.ps1
index 33a6f2d0e..fb23f72f3 100644
--- a/eng/common/build.ps1
+++ b/eng/common/build.ps1
@@ -111,6 +111,7 @@ function Build {
MSBuild $toolsetBuildProj `
$bl `
$platformArg `
+ /check `
/p:Configuration=$configuration `
/p:RepoRoot=$RepoRoot `
/p:Restore=$restore `
diff --git a/eng/common/build.sh b/eng/common/build.sh
index 50af40cdd..fa824d4d7 100755
--- a/eng/common/build.sh
+++ b/eng/common/build.sh
@@ -216,6 +216,7 @@ function Build {
MSBuild $_InitializeToolset \
$bl \
/p:Configuration=$configuration \
+ /check \
/p:RepoRoot="$repo_root" \
/p:Restore=$restore \
/p:Build=$build \
diff --git a/eng/common/tools.ps1 b/eng/common/tools.ps1
index 60352ede1..4da79fc7a 100644
--- a/eng/common/tools.ps1
+++ b/eng/common/tools.ps1
@@ -712,7 +712,7 @@ function InitializeToolset() {
'' | Set-Content $proj
- MSBuild-Core $proj $bl /t:__WriteToolsetLocation /clp:ErrorsOnly`;NoSummary /p:__ToolsetLocationOutputFile=$toolsetLocationFile
+ MSBuild-Core $proj $bl /check /t:__WriteToolsetLocation /clp:ErrorsOnly`;NoSummary /p:__ToolsetLocationOutputFile=$toolsetLocationFile
$path = Get-Content $toolsetLocationFile -Encoding UTF8 -TotalCount 1
if (!(Test-Path $path)) {
diff --git a/eng/common/tools.sh b/eng/common/tools.sh
index b9b329ce3..aedff5ded 100644
--- a/eng/common/tools.sh
+++ b/eng/common/tools.sh
@@ -412,7 +412,7 @@ function InitializeToolset {
fi
echo '' > "$proj"
- MSBuild-Core "$proj" $bl /t:__WriteToolsetLocation /clp:ErrorsOnly\;NoSummary /p:__ToolsetLocationOutputFile="$toolset_location_file"
+ MSBuild-Core "$proj" $bl /check /t:__WriteToolsetLocation /clp:ErrorsOnly\;NoSummary /p:__ToolsetLocationOutputFile="$toolset_location_file"
local toolset_build_proj=`cat "$toolset_location_file"`