question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Option to treat NETSDK warnings as errors

See original GitHub issue

While 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:closed
  • Created 5 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
rainersigwaldcommented, Dec 13, 2018

You can use the universal MSBuild flag with dotnet build /warnaserror. Confusingly, the TreatWarningsAsErrors 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 for msbuild.exe /warnaserror.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found