Skip to content

Commit ab7f3f2

Browse files
authored
Enable /warnAsError (#23072)
* Enable `/warnAsError` in Windows builds - already enabled in non-Windows builds because override existed only in build.ps1 * Allow some warnings related to closed issues - common `<NoWarn>$(NoWarn);CS1591</NoWarn>` case unchanged - /Directory.Build.props ensures that warning remains a warning but doesn't hide it * !fixup! Root build.sh _does_ disable warnings as errors - variable eng/common/tools.sh uses named `warn_as_error`
1 parent 860f402 commit ab7f3f2

File tree

7 files changed

+8
-35
lines changed

7 files changed

+8
-35
lines changed

Directory.Build.props

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
<!-- Workaround issue with ComponentsAnalyzer throwing for interfaces -->
3737
<DisableImplicitComponentsAnalyzers>true</DisableImplicitComponentsAnalyzers>
3838
</PropertyGroup>
39-
39+
4040
<!-- Disable logging of some task parameters or metadata to reduce binlog size.
4141
Reenable logging of any particular item by changing the value of the property below to 'false'
4242
The format is as follows:
@@ -48,22 +48,22 @@
4848
<!-- ItemsToHash is used for incremental building and hashes input properties to a file
4949
This is not generally useful for day-to-day build debugging. -->
5050
<DisableLogTaskParameter_Hash_ItemsToHash>$(TrimTaskParameters)</DisableLogTaskParameter_Hash_ItemsToHash>
51-
51+
5252
<!-- JoinItems takes input ItemGroups. The output ItemGroup is logged. -->
5353
<DisableLogTaskParameter_JoinItems_Right>$(TrimTaskParameters)</DisableLogTaskParameter_JoinItems_Right>
5454
<DisableLogTaskParameter_JoinItems_Left>$(TrimTaskParameters)</DisableLogTaskParameter_JoinItems_Left>
55-
55+
5656
<!-- ConvertToAbsolutePaths - The output parameter (AbsolutePaths) is interesting
5757
while the input Path is not generally useful. The output itemgroup's metadata
5858
is not altered by the task. -->
5959
<DisableLogTaskParameter_ConvertToAbsolutePath_Paths>$(TrimTaskParameters)</DisableLogTaskParameter_ConvertToAbsolutePath_Paths>
6060
<DisableLogTaskParameterItemMetadata_ConvertToAbsolutePath_Paths>$(TrimTaskParameters)</DisableLogTaskParameterItemMetadata_ConvertToAbsolutePath_Paths>
61-
61+
6262
<!-- The standard msbuild Copy task does not use Metadata and thus the input/outputs
6363
item metadata is not relevant -->
6464
<DisableLogTaskParameterItemMetadata_Copy_SourceFiles>$(TrimTaskParameters)</DisableLogTaskParameterItemMetadata_Copy_SourceFiles>
6565
<DisableLogTaskParameterItemMetadata_Copy_DestinationFiles>$(TrimTaskParameters)</DisableLogTaskParameterItemMetadata_Copy_DestinationFiles>
66-
66+
6767
<!-- Reference metadata for GenerateDepsFile, Csc, RAR, etc. are sometimes useful, but extraordinarily large
6868
when building against a shared framework where the number of input assemblies is very large.
6969
Avoid logging these by default. -->
@@ -101,14 +101,11 @@
101101
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
102102
<!-- Don't make missing XML docs a fatal build error, but still surface so we have visibility into undocumented APIs. -->
103103
<WarningsNotAsErrors>$(WarningsNotAsErrors);CS1591</WarningsNotAsErrors>
104+
104105
<!-- xUnit1004 = warns about skipped tests. Make this a non-fatal build warning. -->
105106
<WarningsNotAsErrors>$(WarningsNotAsErrors);xUnit1004</WarningsNotAsErrors>
106-
<!-- Working around https://github.com/NuGet/Home/issues/8467 -->
107-
<NoWarn>$(NoWarn);NU5131</NoWarn>
108-
<!-- Needed until we resolve https://github.com/dotnet/aspnetcore-internal/issues/3103 -->
109-
<NoWarn>$(NoWarn);NU5048</NoWarn>
110107

111-
<!-- TODO: Figure out why these warnings are occuring -->
108+
<!-- Ignore specific Roslyn warnings for now, https://github.com/dotnet/aspnetcore/issues/22090 -->
112109
<NoWarn Condition="'$(IsAnalyzersProject)' == 'true'">$(NoWarn);RS1024;RS1025;RS1026</NoWarn>
113110
</PropertyGroup>
114111

build.ps1

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -358,17 +358,12 @@ if (-not $foundJdk -and $RunBuild -and ($All -or $BuildJava) -and -not $NoBuildJ
358358
# Initialize global variables need to be set before the import of Arcade is imported
359359
$restore = $RunRestore
360360

361-
# Though VS Code may indicate $nodeReuse, $warnAsError and $msbuildEngine are unused, tools.ps1 uses them.
361+
# Though VS Code may indicate $nodeReuse and $msbuildEngine are unused, tools.ps1 uses them.
362362

363363
# Disable node reuse - Workaround perpetual issues in node reuse and custom task assemblies
364364
$nodeReuse = $false
365365
$env:MSBUILDDISABLENODEREUSE=1
366366

367-
# Our build often has warnings that we can't fix, like "MSB3026: Could not copy" due to race
368-
# conditions in building C++
369-
# Fixing this is tracked by https://github.com/dotnet/aspnetcore-internal/issues/601
370-
$warnAsError = $false
371-
372367
# Use `dotnet msbuild` by default
373368
$msbuildEngine = 'dotnet'
374369

build.sh

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -306,10 +306,6 @@ restore=$run_restore
306306
nodeReuse=false
307307
export MSBUILDDISABLENODEREUSE=1
308308

309-
# Our build often has warnings that we can't fix
310-
# Fixing this is tracked by https://github.com/dotnet/aspnetcore-internal/issues/601
311-
warn_as_error=false
312-
313309
# Ensure passing neither --bl nor --nobl on CI avoids errors in tools.sh. This is needed because we set both variables
314310
# to false by default i.e. they always exist. (We currently avoid binary logs but that is made visible in the YAML.)
315311
if [[ "$ci" == true && "$exclude_ci_binary_log" == false ]]; then

eng/Workarounds.props

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,6 @@
1818
<TestRunnerAdditionalArguments>$(TestRunnerAdditionalArguments) -nocolor</TestRunnerAdditionalArguments>
1919
</PropertyGroup>
2020

21-
<PropertyGroup>
22-
<!-- Working around https://github.com/NuGet/Home/issues/8467 -->
23-
<NoWarn>$(NoWarn);NU5131</NoWarn>
24-
<!-- Workaround until https://github.com/dotnet/aspnetcore-internal/issues/3103 is resolved -->
25-
<NoWarn>$(NoWarn);NU5048</NoWarn>
26-
</PropertyGroup>
27-
2821
<!-- Workaround https://github.com/dotnet/roslyn/issues/27975 -->
2922
<PropertyGroup>
3023
<!-- We use the compiler toolset that comes from NuGet Packages rather than the SDK built-in.

src/Mvc/Mvc.Razor.RuntimeCompilation/src/Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation.csproj

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44
<TargetFramework>$(DefaultNetCoreTargetFramework)</TargetFramework>
55
<NoWarn>$(NoWarn);CS1591</NoWarn>
66

7-
<!-- !!! Temporary workaround while we switch TFMs. -->
8-
<NoWarn>$(NoWarn);NU5129</NoWarn>
9-
107
<GenerateDocumentationFile>true</GenerateDocumentationFile>
118
<PackageTags>aspnetcore;aspnetcoremvc;razor</PackageTags>
129
<IsPackable>true</IsPackable>

src/Razor/Microsoft.NET.Sdk.Razor/src/Microsoft.NET.Sdk.Razor.csproj

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313
<NoWarn>$(NoWarn);NU5100</NoWarn>
1414
<!-- It is intentional to not include build/netstandard2.0/Microsoft.NET.Sdk.Razor.targets -->
1515
<NoWarn>$(NoWarn);NU5129</NoWarn>
16-
<!-- Ignore file copy warnings -->
17-
<NoWarn>$(NoWarn);MSB3030;MSB4181</NoWarn>
1816
<!-- Cannot run pubternal check on net46 -->
1917
<DisablePubternalApiCheck>true</DisablePubternalApiCheck>
2018
<!-- Need to build this project in source build -->

src/Razor/test/testassets/Directory.Build.props

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,6 @@
2626

2727
<!-- Working around an issue in XDT transforms -->
2828
<AspNetCoreHostingModel>OutOfProcess</AspNetCoreHostingModel>
29-
30-
<!-- Working around https://github.com/NuGet/Home/issues/8467 -->
31-
<NoWarn>$(NoWarn);NU5131</NoWarn>
3229
</PropertyGroup>
3330

3431
<!-- Don't use the server when building in place. This locks up rzc.dll -->

0 commit comments

Comments
 (0)