未验证 提交 20c18e03 编写于 作者: T Tomáš Matoušek 提交者: GitHub

Do not pass /warnaserror to msbuild (#32152)

上级 b6cdb51d
......@@ -41,7 +41,7 @@ param (
[switch]$deployExtensions,
[switch]$prepareMachine,
[switch]$useGlobalNuGetCache = $true,
[switch]$warnAsError = $true,
[switch]$warnAsError = $false,
# Test actions
[switch]$test32,
......@@ -91,6 +91,7 @@ function Print-Usage() {
Write-Host " -skipAnalyzers Do not run analyzers during build operations"
Write-Host " -prepareMachine Prepare machine for CI run, clean up processes after build"
Write-Host " -useGlobalNuGetCache Use global NuGet cache."
Write-Host " -warnAsError Treat all warnings as errors"
Write-Host ""
Write-Host "Command line arguments starting with '/p:' are passed through to MSBuild."
}
......@@ -158,6 +159,10 @@ function BuildSolution() {
# Do not set the property to true explicitly, since that would override value projects might set.
$suppressExtensionDeployment = if (!$deployExtensions) { "/p:DeployExtension=false" } else { "" }
# Setting /p:TreatWarningsAsErrors=true is a workaround for https://github.com/Microsoft/msbuild/issues/3062.
# We don't pass /warnaserror to msbuild ($warnAsError is set to $false by default above), but set
# /p:TreatWarningsAsErrors=true so that compiler reported warnings, other than IDE0055 are treated as errors.
# Warnings reported from other msbuild tasks are not treated as errors for now.
MSBuild $toolsetBuildProj `
$bl `
/p:Configuration=$configuration `
......@@ -177,6 +182,7 @@ function BuildSolution() {
/p:QuietRestore=$quietRestore `
/p:QuietRestoreBinaryLog=$binaryLog `
/p:TestTargetFrameworks=$testTargetFrameworks `
/p:TreatWarningsAsErrors=true `
$suppressExtensionDeployment `
@properties
}
......
......@@ -30,6 +30,7 @@ usage()
echo " --bootstrap Build using a bootstrap compilers"
echo " --skipAnalyzers Do not run analyzers during build operations"
echo " --prepareMachine Prepare machine for CI run, clean up processes after build"
echo " --warnAsError Treat all warnings as errors"
echo ""
echo "Command line arguments starting with '/p:' are passed through to MSBuild."
}
......@@ -61,6 +62,7 @@ ci=false
bootstrap=false
skip_analyzers=false
prepare_machine=false
warn_as_error=false
properties=""
docker=false
......@@ -125,6 +127,9 @@ while [[ $# > 0 ]]; do
--preparemachine)
prepare_machine=true
;;
--warnaserror)
warn_as_error=true
;;
--docker)
docker=true
shift
......@@ -245,6 +250,10 @@ function BuildSolution {
mono_tool=""
fi
# Setting /p:TreatWarningsAsErrors=true is a workaround for https://github.com/Microsoft/msbuild/issues/3062.
# We don't pass /warnaserror to msbuild (warn_as_error is set to false by default above), but set
# /p:TreatWarningsAsErrors=true so that compiler reported warnings, other than IDE0055 are treated as errors.
# Warnings reported from other msbuild tasks are not treated as errors for now.
MSBuild $toolset_build_proj \
$bl \
/p:Configuration=$configuration \
......@@ -261,6 +270,7 @@ function BuildSolution {
/p:ContinuousIntegrationBuild=$ci \
/p:QuietRestore=$quiet_restore \
/p:QuietRestoreBinaryLog="$binary_log" \
/p:TreatWarningsAsErrors=true \
$test_runtime \
$mono_tool \
$properties
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册