Below includes a demo of the new Visual Studio 2013 Team Build running PowerShell.
One of the new features that I really like in Visual Studio 2013 is the ability to run scripts using the Default Template. This is a huge time saver! Before we had to create a custom activity to call the scripts and pass in the parameters.
Let’s get started by walking through how this new feature of running the PowerShell script in the Default Template works.
Add a PowerShell script to your source control:
In TFS 2013 | Team Explorer | Builds | Right click a Build Definition | Select Edit Build Definition | The Build Definition properties for the build will open
In the Build Definition properties | Select the Source Settings | Make sure that the script is added to the working folder
In the Build Definition properties | Click on Process | The Build Process template will open
In 2. Build section | Expand 5. advanced | The MSBuild, Post, and Pre-script will show
Add the location of the script and any parameters the script requires
Then, run the build and verify the results.
In the Build results | Click on Diagnostics | Click on View Logs | The Diagnostics web page will open
Verify that your script ran as expected.
The new features of being able to run a script from the Default Template gives great flexibility and saves time in building out a robust continuous workflow. Don’t forget to add the pre and post scripts to update the target environment or to preform cleanup tasks.