Sdk: dotnet publish fail on warnings

Created on 11 Jul 2018  路  2Comments  路  Source: dotnet/sdk

Moving issue here from Dotnet.
Issue entered by ChaosCA.
https://github.com/Microsoft/dotnet/issues/799

Full Text from issue:
Hey there,
I apologies if this is the wrong place. This is more of a feature suggestion to have a flag on the dotnet publish command that causes it to exit with a non-zero status code when it encounters a warning.
This is useful for CI/CD applications that are unmanaged, failing on warnings can prevent potentially buggy code from reaching production when it otherwise may have not be caught. Sort of like a strict mode.

Most helpful comment

This is already possible:

dotnet publish /p:TreatWarningsAsErrors=true /warnaserror

More on how this works:

  1. $(TreatWarningsAsErrors) is passed to the compiler (and other tools) run during the build.
  2. /warnaserror will make other MSBuild warnings into errors as well

All 2 comments

Thanks @SusLes!

This is already possible:

dotnet publish /p:TreatWarningsAsErrors=true /warnaserror

More on how this works:

  1. $(TreatWarningsAsErrors) is passed to the compiler (and other tools) run during the build.
  2. /warnaserror will make other MSBuild warnings into errors as well
Was this page helpful?
0 / 5 - 0 ratings

Related issues

natemcmaster picture natemcmaster  路  3Comments

thomaslevesque picture thomaslevesque  路  3Comments

dasMulli picture dasMulli  路  3Comments

fmorriso picture fmorriso  路  3Comments

srayuws picture srayuws  路  3Comments