views:

478

answers:

4

I have a scenario where in I need to define multiple msbuild tasks. I added a projectTrigger but the problem is that you need to specify the triggerStatus to success or failure. I need the build to be happen irrespective of whether the preceeding build succeeds or fails. What is the best solution for this?

A: 

If they all involve the same code base (Be creative with which folders you are monitoring even if it pulls more code than you really need), that way they will all kick off when a modification occurs and you will see success/fail for each one. You could set the order by queue priority.

Or Are you speaking of multiple MSBuild's in a single project? If so the only way I could think of to do this would be to put your first build in the tasks and the others in the publishers section (Yes, you can do this) this is the only way to ensure the following tasks get exectued no matter if the main build pases or fails. The problem with this is that those in the publisher section won't fail the whole build if they fail.

Or...You could create a Master MSBuild that calls all the builds in order....

Alex
A: 

CC.Net allows you to define more than one trigger on a single project. Perhaps you create two project triggers - one for Success and one for Failure.

Pedro
+1  A: 

I can think of two options. As Pedro mentioned, you can setup multiple triggers - one for Success of ProjectA and one for Failure. So, under your ProjectB:

<multiTrigger operator="Or">
    <triggers>
        <projectTrigger project="ProjectA">
            <triggerStatus>Success</triggerStatus>
        </projectTrigger>
    </triggers>
    <triggers>
        <projectTrigger project="ProjectA">
            <triggerStatus>Failure</triggerStatus>
        </projectTrigger>
    </triggers>
</multiTrigger>

The other way you can do it is from the other direction: use the Force Build Publisher. Instead of setting up a trigger in ProjectB, you can have ProjectA force the build:

<publishers>
    <!-- other publishers... -->
    <forcebuild>
        <project>ProjectB</project>
        <integrationStatus>Success</integrationStatus>
    </forcebuild>
    <forcebuild>
        <project>ProjectB</project>
        <integrationStatus>Failure</integrationStatus>
    </forcebuild>
</publishers>

It is slightly wonky that you have to define two cases (for Success and Failure). I haven't researched if there's a better way.

bentsai
A: 

Multiple triggers is a good idea, however as i implemented it with the syntax above, it didnt work. Heres the code that worked well for me:

Success

  <projectTrigger project="ProjectA">
   <triggerStatus>Failure</triggerStatus>
  </projectTrigger>
 </triggers>
</multiTrigger>

This what the comment system is for!
Si
Oh, my apologies, you probably don't have enough rep to do this, sorry!
Si