-
Notifications
You must be signed in to change notification settings - Fork 0
WarningsBaselineInit
π§ Init warnings baseline
dotnet biak warnings-baseline init [--target <path>]
After a few moments, something similar should appear:
Choose one: add this full snippet to `Directory.Build.props`, or if you configure in a `.csproj` file(s), add only `<TreatWarningsAsErrors>true</TreatWarningsAsErrors>` inside an existing `<PropertyGroup>`.
<Project>
<PropertyGroup>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
</Project>
Insert these filters into your .editorconfig file
[{VisualBasicProject/Module1.vb}]
dotnet_diagnostic.BC40000.severity = suggestion # ^biak^ baseline
[{DerivedClassCS0649.cs}]
dotnet_diagnostic.CS0108.severity = suggestion # ^biak^ baseline
[{ProgramCS0168Warning.cs}]
dotnet_diagnostic.CS0168.severity = suggestion # ^biak^ baseline
[{MyClassCS0169.cs}]
dotnet_diagnostic.CS0169.severity = suggestion # ^biak^ baseline
[{ProgramCS0219Warning.cs}]
dotnet_diagnostic.CS0219.severity = suggestion # ^biak^ baseline
[{ProgramCS0612.cs}]
dotnet_diagnostic.CS0612.severity = suggestion # ^biak^ baseline
[{DerivedClassCS0649.cs}]
dotnet_diagnostic.CS0649.severity = suggestion # ^biak^ baseline
[{MyTestForlder/MyTestModel1.cs,MyTestModel.cs}]
dotnet_diagnostic.CS8618.severity = suggestion # ^biak^ baseline
Warning
Do not remove the # ^biak^ baseline marker, as it is used for the Sync command.
- Execute a full project build (30-minute timeout), or build an explicit target from
--target <path> - If build errors are detected, terminate execution
- Extract warnings from the generated binary log
- Retain only warnings associated with
.csand.vbsource files - If no applicable warnings are found, terminate execution
- Generate and output the corresponding
.editorconfigbaseline entries
If a warning originates from a global project-level configuration, such as a .csproj setting (e.g., NU1901), it cannot be configured through an .editorconfig rule. In the case of F#, warning filtering via .editorconfig is not supported (SOF). Similarly, warning suppression for .cshtml (Razor Pages) is subject to limitations, and certain warnings cannot be disabled (SOF).
Unfortunately, if you write ... = warning # ^biak^ baseline instead of ... = suggestion # ^biak^ baseline and set <TreatWarningsAsErrors>true</TreatWarningsAsErrors>, the filter will not be applied and all warnings will become errors.
Hey! If you don't have write access to the wiki, you can change that in the docs/wiki folder.