-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add note on WarningsAsErrors #81451
Add note on WarningsAsErrors #81451
Conversation
Tagging subscribers to this area: @dotnet/area-meta Issue DetailsCc @ivdiazsa
|
|
||
## Warnings as Errors | ||
|
||
The repo build treats warnings as errors. Dealing with warnings when you're in the middle of making changes can be annoying (e.g. unused variable that you plan to use later). To disable treating warnings as errors, set the `WarningsAsErrors` environment variable to `false` before building. This variable will be respected by both the `build.sh`/`build.cmd` root build scripts and builds done with `dotnet build` or Visual Studio. Some people may prefer setting this environment variable globally in their machine settings. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Internal and public alike, environment variables naming convention in the repo is
DOTNET_TREAT_WARNING_AS_ERROR=false or =0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This sets an MSBuild property that is documented to be named like this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed the TreatWarningsAsErrors
is checked here:
https://github.com/dotnet/runtime/pull/81402/files#diff-0eee3e18fdac60b29b08c403d130ff9badcadeb22e2e8f01b1ddd34fdeb59ef0R270
This confused me as to what environment variable name we should be using: TreatWarningsAsErrors
, or WarningsAsErrors
?
From what I understood (https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/compiler-options/errors-warnings), TreatWarningsAsErrors
is intended to be a boolean, whereas WarningsAsErrors
is the list of diagnostic ids to upgrade from warnings to errors.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sigh, yeah, it's TreatWarningsAsErrors. I'll fix it.
Thanks for adding this @MichalStrehovsky! The note looks very much on point. |
Cc @ivdiazsa