.net – Ignore NAnt warning

nantnet

I'm setting up a build server using NAnt (and CruiseControl.NET) and I'm currently writing the build file for all the assemblies (both in VB.NET/C#) in the application.
Unfortunately whem compiles most of the projects, NAnt signals several warnings which stop the building process. Since I know these warnings are almost unrealistic (the vast majority of this warning comes from code like

If object Is Nothing

which generates a warning like "A Null reference exception COULD result at runtime", emphasys is mine, of course) I would like to make NAnt just show them without stopping the building process.
Thanks in advance to anyone who will help

Best Answer

CSC and MsBuild have parameters to specify to treat warnings as errors - you should check that these are set to false:

<property name="build.warnaserrors" value="false" />

MsBuild

<exec program="path/to/MSBuild.exe" workingdir="path/to/dir">
    <arg value="/p:TreatWarningsAsErrors=${build.warnaserrors}" />
    ....other args
</exec>

CSC

<csc warnaserror="${warnaserrors}"
    ...other args
></csc>
Related Topic