msbuild - Trigger build when another finished successfully in TFS 2008 -


this feature i'm used teamcity - specify build configuration triggered success of build configuration.

i pass results of 1 build - perhaps asking much.

i'm looking similar functionality in tfs2008, there way set trigger on build configuration shall start after finished successfully?

i use following target in tfsbuild.proj:

inject new targets build process. trigger dependent builds if "drop" created:

<propertygroup>     <dropbuilddependson>         $(dropbuilddependson);         createdependentbuilditemgroup;         triggerdependentbuilds;     </dropbuilddependson> </propertygroup> 

create itemgroup contains list of dependent builds want trigger (the include attribute list name of dependent build appears in build explorer - in case below, dependant build called "integration"). in our build process, want trigger more 1 build, , want point next build @ binaries produced current build (in example, want run integration tests against binaries produced). notice hack around spaces in configuration names - eg "any cpu" cause problem in msbuild args. using format, can have custom msbuild args per dependent build.

<target name="createdependentbuilditemgroup">     <itemgroup>         <dependentbuild include="integration">             <!--using 8dot3 format "mixed platforms" it's tricky (impossible?) pass space char within /msbuildarguments of tfsbuild-->             <msbuildargs>/p:callingbuilddropfolder=$(droplocation)\$(buildnumber)\mixedp~1\ship;cismallbuildnumber=$(cismallbuildnumber);buildnumberpostfix=$(buildnumberpostfix)</msbuildargs>             <priorityarg>/priority:abovenormal</priorityarg>         </dependentbuild>     </itemgroup>     </target> 

now, trigger builds. notice use custom getoption: want make sure dependent builds use same changeset current build used - can't use latest, cos may have checked in in meantime - want dependent builds in our "chain" based of same changeset. actual command within exec, , buildstep stuff make sure report success (or failure) of exec.

<target name="triggerdependentbuilds"         condition=" '$(compilationstatus)' == 'succeeded' ">     <buildstep teamfoundationserverurl="$(teamfoundationserverurl)"                builduri="$(builduri)"                name="triggerstep"                message="triggering dependent builds">         <output taskparameter="id"                 propertyname="triggerstepid" />     </buildstep>      <propertygroup>         <triggerbuildcommandbase>tfsbuild start $(teamfoundationserverurl) $(teamproject)</triggerbuildcommandbase>     </propertygroup>      <exec         continueonerror="true"         workingdirectory="c:\program files (x86)\microsoft visual studio 9.0\common7\ide"         command="$(triggerbuildcommandbase) %(dependentbuild.identity) /queue /getoption:custom /customgetversion:$(getversion) %(dependentbuild.priorityarg) /msbuildarguments:&quot;%(dependentbuild.msbuildargs)&quot;">         <output taskparameter="exitcode"                 itemname="tfsbuildresult"/>     </exec>      <buildstep condition="'@(tfsbuildresult)'=='0'"                teamfoundationserverurl="$(teamfoundationserverurl)"                builduri="$(builduri)"                id="$(triggerstepid)"                status="succeeded" />     <buildstep condition="'@(tfsbuildresult)'!='0'"                teamfoundationserverurl="$(teamfoundationserverurl)"                builduri="$(builduri)"                id="$(triggerstepid)"                status="failed" /> </target> 

i hope helps...


Comments

Popular posts from this blog

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -