Log warning and errors in a custom action

Some time ago I blogged about logging in custom action for TFS build 2010, I left out some details. Suppose you want to create a warning or an error and not a simple message, you need to create a specialized version of the LogWarning that logs a real warning.

image

You can do the same with errors.

image

These two methods permit you to log warnings and errors during a custom build action execution, let’s see how they affect the output. First of all you can verify that when you log an error the build partially succeeds

image

The error and warning are reported in the detailed report with their right icons

image

And they are also reported in the View Summary of the build

image

Next time I’ll explain you how to wrap a msbuild Custom Task in a custom action.

Alk.

Tags: Tfs