Tutorial :True start/stop with msbuild task regardless of error


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.


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.

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »