MSBuild projects prebuild step can fail when building with Hudson

I’ve recently ran into a problem where Hudson wouldn’t compile our solution since it will fail when were doing some special work in a prebuild step.

The reason was that we had some project with a prebuild step that used the “find” command line tool. However if you install mysisgit on windows it too contains a find tool, and these two tools differ.

I added a build step that used where to see which “find” hudson was using and I quickly found out that it was indeed using the mysisgit’s version of find. This caused the following output:

C:\dev\remotex\continuous-delivery-with-hudson\hudson\home\jobs\Package\workspace>where find C:\dev\remotex\continuous-delivery-with-hudson\hudson\home\jobs\Package\workspace\find C:\dev\Git\bin\find.exe c:\Windows\System32\find.exe

As you can see “where” finds two different locations for the command find, and they work differently.

To fix this I had to change all our post build tasks to run with the specific find tool I wanted to use.

Instead of calling just “find” in my prebuild step I had to specify it like this:

%COMSPEC:cmd=find%

Thanks to Johan Andersson whom came up with the idea.