0

I have a Xamarin.Forms project wherein the Android project is built in VSTS using a hosted build agent which runs a powershell script at run-time.

I need to run the same powershell script against the Xamarin.iOS which uses an On Premise Mac Build Agent. But how?

Lex Li
  • 60,503
  • 9
  • 116
  • 147
Jarrod L
  • 285
  • 5
  • 16

1 Answers1

0

I found this answer and a comment under the answer also had the same question regarding parameters, so I am posting the solution here since the issue is slightly different and that question has an accepted answer.

First off, I installed powershell on the mac using these instructions and I modified the shell script task to include the Visual Studio Team Services (VSTS) environmental variables that I wanted to pass to the powershell script.

enter image description here

Next, I pass the arguments through to the called powershell script by slightly modifying the shell script mentioned by the referenced answer.

#!/bin/bash
powershell ./Version.ps1 $1 $2

Finally, in the powershell script, I catch the arguments that have been passed through using using param like this:

param([string]$version, [string]$path)

Wherein I can now use the variables $version and $path which contain the original arguments entered in VSTS to the needs of my powershell script.

Jarrod L
  • 285
  • 5
  • 16