Thursday, May 20, 2010

MSBuild is strange sometimes...

So I've finally gotten around to creating a profile at http://stackoverflow.com/, because I've run into an issue that warranted posting. FWIW, I'm also trying out MS Connect on this issue. You should refer to those links for a full synopsis of what's going on. But, suffice it to say, I've managed to create a situation where MSBuild behaves differently if I:
  • Run MSBuild against a solution file via the "Exec" task in an MSBuild script
  • Run MSBuild against a solution file via the "MSBuild" task in an MSBuild script

Interestingly enough, I've also found that if I first run the build using the "Exec" task, and THEN using the "MSBuild" task, all is well. But if I try to run using the "MSBuild" task a second (or third, or fourth, etc.) time, it fails. Very odd indeed.

Now, I am typically a fan of MSBuild. I like how it comes for free with the framework (so it's not an additional environmental dependency). I generally like how it is simple to define build workflows with it. But, occasionally, I run into a fun little bug/feature like this that drives me insane (and destroys my productivity) for a day or two. Oh well.