views:

22

answers:

1

I was wondering if it's possible to have something like a try, catch, finally in an msbuild script. I'm trying to set it up so that I can stop an IIS site and app pool, do some building, copy over files and then make sure that even if something goes wrong during the build and files don't get copied it can at least bring the site back up with the older files.

+1  A: 

Every task can have the attribute ContinueOnError="true" specified to indicate the target execution should continue executing even if the task failed. If you are using MSBuild 4 then you can also use the new property MSBuildLastTaskResult to determine if the last task was a success (true) or failure (false). If you are not using MSBuild 4 then you might not be able to determine if the task was a success or failure.

Sayed Ibrahim Hashimi