Cordova iOS build fails in Azure DevOps server build pipeline using command line task and CordovaCommand Task

Hi,

Trying to build iOS code using Cordova on Azure DevOps server. I have used both the CordovaCommand task and CmdLine task but none seems to work. It seems like build arguments fails to recognize spaces.
I am running the build ona hosted MacOS Agent.

Cordova version: 9.0.0
Ionic Version: 6.6.0

YML:

  • task: CmdLine@2 inputs: script: | echo build ios files cordova build ios --release --device --developmentTeam=TeamID --codeSignIdentity="$(codeSignIdentity)" --buildFlag="-UseModernBuildSystem=0"

Variable $(codeSignIdentity) contains the string “iPhone Developer” . I’ve tried with escape characters, double quotes, single quotes, hardcoded string but none seems to work. The build fails with error below:


The platform “Developer” does not appear to have been added to this project.

##[error]Bash exited with code ‘1’.

Appreciate any fix or a workaround.

HI,

Found a workaround. The only viable option was to use build.json, instead of inline arguments. That did the trick :slight_smile:

/Mewan

Can you, please, explain how did you work this around?

Hi,

As I have mentioned in the above comment, I defined parameters the build.json file and used it in the cordova build ios command.

In other words, create a build.json file as given in the cordova documentation (an example is available in the documentation)

Then you may add it to secure files in the build pipeline and specify it in the command as follows (you will also need the secure file download task in the pipeline assistant, in order to download the build.json file to the build agent in the process):

ionic cordova build ios --device --release --buildConfig="[path to the temp folder in the build agent]/build.json

Hope this is clear.

Best Regards,
M

1 Like