Option to treat NETSDK warnings as errors
See original GitHub issueWhile updating to 2.2.100 I noticed a couple of warnings were added. Like NETSDK1071
.
In my CI I build using the TreatWarningsAsErrors
flag (dotnet build /p:TreatWarningsAsErrors="true"
)`.
The build still completed succesfully, while NETSDK1071
was thrown.
What is the recommended way to force a build to fail if any of these warnings are thrown from the SDK? The most user friendly way would be to use the same flag as msbuild. But that doesn’t seem to be supported atm.
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
C# Compiler Options to report errors and warnings
C# Compiler Options for errors and warnings. These options suppress or enable warnings, and control warnings as errors.
Read more >Treating Warnings as Errors in .NET projects - bytedev - Medium
Compiler warnings can be an indication of potential problems in your code project. For this reason it can be good practice to treat...
Read more >visual studio - Warning as error - How to get rid of these
Right-click on your project, select "Properties". Click "Build". Switch "Treat warnings as errors" from "All" to "Specific warnings" or "None".
Read more >how to make warning like errors in Visual Studio
You can choose which warnings to treat as errors by using settings in the project file. There are two approaches: Include specific warnings...
Read more >Is it a good practice to treat warnings as errors? - Paweł Bulwan
Making Visual Studio treat warnings the same way as errors .NET projects have an interesting property that we can set.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
You can use the universal MSBuild flag with
dotnet build /warnaserror
. Confusingly, theTreatWarningsAsErrors
is fairly specifically scoped down to compiler warnings (though other tasks have the option of opting in to it as well). That property was added before MSBuild added support formsbuild.exe /warnaserror
.@nphmuller https://github.com/dotnet/core-sdk/issues/1708