Treat warnings as errors repo-wide

A clean build currently has zero warnings; enforce that so new ones can't
accumulate unnoticed. Set TreatWarningsAsErrors in the root
Directory.Build.props rather than per project. ICSharpCode.ILSpyCmd keeps
its existing TreatWarningsAsErrors=false (project-level wins over the
imported default), and the three legacy net472 projects (the VS add-ins
and the installer builder) opt out explicitly since they only build on
Windows and aren't covered by the cross-platform CI that gates this.

Assisted-by: Claude:claude-opus-4-8:Claude Code
This commit is contained in:
Siegfried Pammer
2026-06-10 00:11:56 +02:00
parent 87748e0cde
commit 40a667fefb
4 changed files with 13 additions and 0 deletions
+7
View File
@@ -3,6 +3,13 @@
<NoWarn>$(NoWarn);NU1510</NoWarn>
</PropertyGroup>
<PropertyGroup>
<!-- Warnings are errors repo-wide so a clean build stays clean; individual projects can opt
back out (e.g. ICSharpCode.ILSpyCmd sets TreatWarningsAsErrors=false) since project-level
properties override this imported default. -->
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
<PropertyGroup>
<EnableNUnitRunner>true</EnableNUnitRunner>
</PropertyGroup>
@@ -11,6 +11,8 @@
<Version>1.7.1.0</Version>
<FileVersion>1.7.1.0</FileVersion>
<LangVersion>9.0</LangVersion>
<!-- Legacy net472 add-in: opt out of the repo-wide warnings-as-errors (Directory.Build.props). -->
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<EnableDefaultItems>False</EnableDefaultItems>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+2
View File
@@ -11,6 +11,8 @@
<Version>1.7.1.0</Version>
<FileVersion>1.7.1.0</FileVersion>
<LangVersion>9.0</LangVersion>
<!-- Legacy net472 add-in: opt out of the repo-wide warnings-as-errors (Directory.Build.props). -->
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<EnableDefaultItems>False</EnableDefaultItems>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+2
View File
@@ -4,6 +4,8 @@
<OutputType>Exe</OutputType>
<TargetFramework>net472</TargetFramework>
<StartupObject>ILSpy.Installer.Builder</StartupObject>
<!-- Legacy net472 installer builder: opt out of the repo-wide warnings-as-errors (Directory.Build.props). -->
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
</PropertyGroup>
<PropertyGroup>