Lately I have been working a lot with TestStand deployment utility to organize the proper release verisoning of TestStand project. One of the consistent feedback of a customer is that they find hard contorl the various TestStand sequence file and numerous versions and dependencies floating around the manufacturing floor. I suggested them to use TestStand deployment utility and put those up in a CI (Continuous Integration) server so that whenever the test engineer changes the sequence, there will be a package spits out from the server with proper versioning. What I really ended up is helping them to setup and burying myself in the mysteries of TestStand deployment utility unknown areas.
First thing I came across is the BuildTSD.exe that helps in command line execution for TestStand Deployment utility. I found most the old files and new NI help documents and bursted out to solve it.
However when I started using the environment files, I found myself in Exit Code 2. To a strange it took a while for me to figure out how to display the exit code thrown by the execution using powershell. I use windows based CI runner that runs with PowerShell. Then I found $? is the command to know about exit code but it gives only boolean output (True:everything went well and False:soemthing wrong).
Then when I tried $? again I found a contradictory results. Basically $? in powershell returned whether the last command executed good or not. For itself executed again in next line give true.

Then I found myself pulling the only few hairs left out in my head to figure out why the exit code keeps on occuring, though my build went successful and I did get the .pkg files as I wanted. What eventually I found is that I shouldn’t give the environment file path in TSD UI if I send the env path in command line. So I had to remove them from command line and also uncheck the “Use Environment File To Determine Deployed File Destinations”

Finally the working command was something like below with above .tsd file config
BuildTSD.exe
>> /versionString "1.1.0.10"
>> /DeployEnvironmentFile true
>> /ActiveEnvironmentFile $pwd\Source\TS_Env.tsenv
>> /copyLogFiles "C:\BitBucket\ts_deployment_testing"
$pwd\Source\TS_Dep_Test.tsd
Ajay is a professional developer and architect of NI-LabVIEW applications with extreme interest in getting the hardware connected to LabVIEW and automating the stuff. Recently he is also putting his hands in NI-TestStand to get very dirty on it. He is also a good mentor for the various interns in his career. He is ready to help the people in techie roles.