How to call a Batch Script or a PowerShell Script using TFS 2013 Team Build Pre-Build or Post-Build parameters option.
Now in TFS 2013 team build we can run the Batch Scripts or PowerShell Scripts without modifying the build process template. For this we will make use of any one or combination of these events based on the requirement i.e. Pre-Build or Post-Build or Pre-Test or Post-Test process parameters in Build Definition process tab.
Lets assume that we have an application already in TFS Version control which will be used in the below build definition.
In this post I will showcase how to call a Batch Script from build definition which will create a text file with some text messages.
Step 1: Create a simple Batch file named CreateTextFile.bat with scripts as shown below,
Step 2: Connect to TFS Team Project , add and Check-in batch script file CreateTextFile.bat to the Version Control.
Step 3: Create a build definition using TFS 2013 default build template and make sure that the script file is mapped to the agent folder in Source Setting tab of build definition.
Step 4: In build definitions Process tab provide the version control path of CreateTextFile.bat as below.
Step 5: Trigger the build and verify that DemoTextFile.txt is created in path C:\
We can follow the above steps to execute PowerShell or any scripts using team build.
Thanks.
Good info on Build steps customization!
ReplyDeleteKeep up the good work....