Can switch warning message to error message in msbuild?

Answered Can switch warning message to error message in msbuild?

  • segunda-feira, 26 de março de 2012 12:49
     
     

    Hello,

     I want to treat warning message to error message in msbuild.I changed the property of project(In Build Tab of Property of project,choose "All" option button in Treat warnings as errors in Release Mode and choose "None" option button in Debug Mode).But it cann't be changed the warning to error messages.Please can explain about this?

    Thanks and Regards,

    ACTY Sytem.


    kyawzin

Todas as Respostas

  • terça-feira, 27 de março de 2012 05:03
    Moderador
     
     Respondido

    Hi ACTY,

    If you build the project using MSBuild Command line, the default platform configuration is Debug|AnyCPU. If you didn't specific any configuration, MSBuild will use the settings defined for Debug|AnyCPU. You sets the debug setting as NONE, which will take no effect on the building as expected.

    MSBuild use the property <TreatWarningsAsErrors> which accepts a boolean value to indicate whether we want to treat warnings as error. When we want to use command line to override the property, we can use " /t:TreatWarningsAsErrors = true" to force the MSBuild use this overrided property.

    More information about command line of MSBuild, please check http://msdn.microsoft.com/en-us/library/ms164311.aspx

    Regards,

    Yi


    Yi Feng Li [MSFT]
    MSDN Community Support | Feedback to us

  • quinta-feira, 29 de março de 2012 08:29
    Moderador
     
     

    Hi,

    I am writing to check the status of the issue on your side.  Would you mind letting us know the result of the suggestions? 

    Yi


    Yi Feng Li [MSFT]
    MSDN Community Support | Feedback to us

  • quinta-feira, 11 de outubro de 2012 05:43
     
     

    Hi,

    Little correction in uses use "/p:TreatWarningsAsErrors = true"  instead of " /t:TreatWarningsAsErrors = true" .

    Thanks.