Treat Warnings as errors flag?

Topics: User Forum
Sep 25, 2014 at 9:49 AM
Is there a treat warnings as errors flag for SHFB to fail the build on missing documentation?
Coordinator
Sep 25, 2014 at 3:22 PM
No, they're always warnings. I could make it an option I suppose but compiling your assembly's project with the compiler's "warnings as error" option would probably get you the same effect.

Eric
Sep 26, 2014 at 11:36 AM
Hi Eric,

I already use warnings as errors. Unfortunately the compiler doesn't check everything that sandcastle checks:
  • Missing namespace documentation
  • Wrong cref targets
  • Changed parameter names when using inheritdoc
So it would be cool to have such an option.

Kind regards,
Michael
Coordinator
Sep 27, 2014 at 6:21 PM
Edited Sep 27, 2014 at 6:23 PM
I'm not sure there's a good way to do this. For one thing, BuildAssembler isn't like a compiler. It won't go through the whole build and report the errors at the end. It will stop on the first error. Also, wrong cref targets won't get reported by the Show Missing Component. Instead, they are reported by the Resolve Reference Links component.

I suppose BuildAssembler could throw an error when done if warnings are reported but I don't see that as being any better than just checking the end of the BuildAssembler output to see if there's a warning count. If you're building from the command line or within Visual Studio, warnings are reported by MSBuild even when not using verbose logging so they're easy to see. By the time BuildAssembler runs, the bulk of the build is done anyway so there isn't much left to do besides generate the help file which typically doesn't take that long. Aborting the build there doesn't really gain you much.

Eric
Sep 30, 2014 at 12:43 PM
I understand the problem.
The use case is not to fail the build earlier, but to fail the build in general with all warnings upgraded to errors.
Perhaps it is something that can be solved with msbuild in the targets file.