Now I'm creating a vsts build task, my approach is:
- Run powershell script
- Inside the powershell, I'll run the exe or dll
- Then use the output to extract the value.
My issue is:
- I do a lot of printing, and I'll print my value at the end and add some delimiter to be able to extract it
- but I feel like it's a bad design I'm not expert in powershell scripting but
- if anyone has a better design please let me know
Not sure if the script code helps but here it is
$psi = New-object System.Diagnostics.ProcessStartInfo
$psi.CreateNoWindow = $true
$psi.UseShellExecute = $false
$psi.RedirectStandardOutput = $true
$psi.RedirectStandardError = $true
$psi.FileName = "app.exe"
$process = New-Object System.Diagnostics.Process
$process.StartInfo = $psi
[void]$process.Start()
$output = $process.StandardOutput.ReadToEnd()
$process.WaitForExit()
then process the output