pauloya
pauloya

Reputation: 2563

Trigger an iOS Visual Studio Cordova build form the command line

I can successfully run a build of the Android app from the command line.

For iOS the build fails using this command line:

"C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\devenv.com" "<Solution>.sln" /rebuild "Distribution|iOS" /project "<projectName>" /projectconfig "Distribution|iOS"

This is the error:

1>MSBUILD : cordova-build error BLD301: Error : BLD00301 : A remote iOS build agent has not been configured. Configure one in Tools > Options > Tools for Apache Cordova > Remote Agent Configuration. For details and alternatives see http://go.microsoft.com/fwlink/?LinkID=511904

I have the remote server configured in visual studio but obviously this is not being picked up. Is there a way to feed this configuration into the batch build?

Upvotes: 2

Views: 1672

Answers (2)

Compulim
Compulim

Reputation: 1168

To build your Cordova iOS project under MSBuild, with help of Cordova Tools for Visual Studio. You need to add a property to your MSBuild named iOSRemoteBuildServer. The build command line should looks like this, I am using debug build as an example:

"C:\Program Files (x86)\MSBuild\12.0\Bin\msbuild.exe"
    /p:Configuration=Debug
    /p:LangName=en-US
    /p:Platform=iOS
    /p:DebuggerFlavor=iOSRemoteDevice
    /p:iOSRemoteBuildServer=http://192.168.0.123:3000

You will find your IPA output at bin\iOS\Debug\ folder.

If MSBuild failed with missing environment variables, the followings should help (assume you are on Cordova Tools CTP3.1 and Node.js 64-bit):

SET MDAVsixDir=%VS120COMNTOOLS%..\IDE\EXTENSIONS\IIC52DPN.UDK
SET NodeJsDir=C:\Program Files\nodejs\
SET NpmInstallDir=%APPDATA%\npm

To set a security PIN for retrieving the client certificate, you can use MSBuild property iOSRemoteBuildSecurityPIN but I have not tested this property yet.

Upvotes: 3

Subhag Oak
Subhag Oak

Reputation: 1654

Please note that you need to start the remote agent on your Mac machine, get the IP/host, the port and the pin and configure it using Tools --> Options --> Tools for Apache Cordova in VS, before you can initiate the build. Visual studio wouldn't start the remote server for you.

The process to setup the remote agent is explained at https://msdn.microsoft.com/en-us/library/dn771551.aspx.

Upvotes: 0

Related Questions