Run powershell build step in VSTS agent installed on mac?

后端 未结 6 813
暖寄归人
暖寄归人 2021-01-23 22:46

I installed VSTS build agent on mac to build xamarin iOS project. Builds worked fine until I added powershell build step. Even though I installed powershell for mac (https://git

6条回答
  •  野的像风
    2021-01-23 23:29

    This is a follow-up to the accepted answer to address a question in a comment which I also had.

    Thanks to spatialguy for posting and finding a simple solution to this problem. I had the same problem as KeithA45:

    QUESTION: What if you wanted to do the same, but also pass arguments to the Bash script which passes them to the Powershell script?

    I found a solution to this, first off, 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.

    Next, I pass the arguments through to the called powershell script by slightly modifying the shell script mentioned by the accepted 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.

提交回复
热议问题