1. First I am going to create a batch file and a PS script. My PS script will do all the work. Batch file (.bat) will be used to initiate the powershell script from Lab Workflow. To get this to work I need to make sure my batch file and the PS script is copied to build output folder, since it is the place that I can execute a deployment script from Lab Work Flow.
I have added my .bat file and the PS script file under a VS project that is under a solution I am building, and set the Copy to Output as always.
2. This will copy my .bat and PS script to Build Drop folder.
3. This is what I have in my .bat file. It is simply executing the PS script making sure execution policy is not blocking anything. Build location here is passed as an argument from the Lab Workflow.
4. In my Lab Build in the deployment steps I specify the .bat file to run as below. For more information and how to use xcopy to copy build out put have a look at "Creating Deployment Scripts for Build-Deploy-Test Workflows". I used a poweshell script since I am going to do lot more than just copying files, like adding dlls to GAC, etc which I will explain in a next post.
$BuildLocation is giving the build output location of the build that is queued/used by Lab workflow.
5. In my poweshell script I am copying zip to my lab environment machine. The path C:\ ..refers to the path in the lab environment machine, since the deployment script get executed in the context of given lab environment machine as specified in the above screenshot.
After copying this script will extract contents to the copied location and remove the zip file from the Build Drop folder. Build Location is passed to the poweshell script from the above .bat file as a parameter.
6. I queue a build and I can see my zip file copying actions get executed in the Build Log as below.
7. In my lab environment machine I see the extracted files .
This is cool .. don't you think..