Logging results from InvokeProcess in a VS2010 Team Build

When you use the InvokeProcess activity, as I did in my Typemock post, you really need to setup the logging. This is because by default nothing will be logged other than the command line invoked, not usually the best option. There are a couple of gotta’s here that initially caused me a problem and I suspect could cause a new user of the 2010 build process a problem too.

The first is that you need to declare the variable names for the InvokeProcess to drop the output and errors into. This is done in the workflow designer putting the variable names in the relevant textboxes (there is no need to declare the variable names anywhere else) as shown below. Use any name you fancy, I used stdOutput and stdError.

image

You then need to add the WriteBuildMessage and WriteBuildError activities by dragging them from the toolbox into the hander areas of the InvokeProcess activity.

The second gotta is that the WriteBuildMessage takes a logging level parameter. This defaults to normal, this means the message will not be displayed in the standard build view (unless the build’s detail level is altered). To get ground this, as I would normally want to see the output of the process being invoked, I would set the Importance of the message to High. Remember you also need to set the Message parameter to the previously declared variable name, in my case stdOutput. This is done in the properties windows as shown below.

image

Note that you don’t need to set an importance on the WriteBuildError activity as this is automatically always displayed, you just need to set the Message parameter to stdError.

Once you make these changes and run the build, you see the output of the command line (green) in the build log as well as the command line (red). This should help with debugging your InvokeProcess activities in your build process.

image