Skip to content
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

Option to treat NETSDK warnings as errors #2748

Closed
nphmuller opened this issue Dec 13, 2018 · 5 comments
Closed

Option to treat NETSDK warnings as errors #2748

nphmuller opened this issue Dec 13, 2018 · 5 comments

Comments

@nphmuller
Copy link

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.

@rainersigwald
Copy link
Member

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.

@nphmuller
Copy link
Author

Thanks for the quick response!

@Crono1981
Copy link

This still causes the build to exit with a success code when warnings occurs. :(

@nphmuller
Copy link
Author

@Crono1981 Might be better to open a new issue for that. Would probably give you a proper response faster.

@Crono1981
Copy link

@nphmuller https://github.com/dotnet/core-sdk/issues/1708

wli3 pushed a commit that referenced this issue Feb 7, 2020
….2 (#2748)

- Microsoft.NET.Sdk - 5.0.100-alpha1.19458.2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants