Skip to content

Commit b11bdaa

Browse files
authored
Unify warnAsError build option between Unix and Windows (#80916)
1 parent f3aba8c commit b11bdaa

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

eng/build.sh

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,11 @@ function BuildSolution {
282282
test_runtime_args="--debug"
283283
fi
284284

285+
local msbuild_warn_as_error=""
286+
if [[ "$warn_as_error" == true ]]; then
287+
msbuild_warn_as_error="/warnAsError"
288+
fi
289+
285290
local generate_documentation_file=""
286291
if [[ "$skip_documentation" == true ]]; then
287292
generate_documentation_file="/p:GenerateDocumentationFile=false"
@@ -292,11 +297,6 @@ function BuildSolution {
292297
roslyn_use_hard_links="/p:ROSLYNUSEHARDLINKS=true"
293298
fi
294299

295-
# Setting /p:TreatWarningsAsErrors=true is a workaround for https://github.com/Microsoft/msbuild/issues/3062.
296-
# We don't pass /warnaserror to msbuild (warn_as_error is set to false by default above), but set
297-
# /p:TreatWarningsAsErrors=true so that compiler reported warnings, other than IDE0055 are treated as errors.
298-
# Warnings reported from other msbuild tasks are not treated as errors for now.
299-
300300
MSBuild $toolset_build_proj \
301301
$bl \
302302
/p:Configuration=$configuration \
@@ -312,13 +312,14 @@ function BuildSolution {
312312
/p:RunAnalyzersDuringBuild=$run_analyzers \
313313
/p:BootstrapBuildPath="$bootstrap_dir" \
314314
/p:ContinuousIntegrationBuild=$ci \
315-
/p:TreatWarningsAsErrors=true \
315+
/p:TreatWarningsAsErrors=$warn_as_error \
316316
/p:TestRuntimeAdditionalArguments=$test_runtime_args \
317317
/p:DotNetBuildSourceOnly=$source_build \
318318
/p:DotNetBuild=$product_build \
319319
/p:DotNetBuildFromVMR=$from_vmr \
320320
$test_runtime \
321321
$mono_tool \
322+
$msbuild_warn_as_error \
322323
$generate_documentation_file \
323324
$roslyn_use_hard_links \
324325
${properties[@]+"${properties[@]}"}

0 commit comments

Comments
 (0)