Access denied when running a command with InvokeProcess in a TFS team build

When you are trying to run a command line tool via the InvokeProcess activity in a TFS 2010 Team build you might see the somewhat confusing ‘Access denied’ error. There appears to be no more detail in the log.

I have found that this is usually down to a type on the filename property of the activity.

It should be set to something like

“c:my toolstool.exe”

but is actually set to

“c:my tools”

i.e. it is set to the folder not the filename. An easy mistake to make of cutting and pasting paths in from batch files.

You cannot execute a folder, hence the access denied error. Simple but easy to miss.