locked
Building an iOS project from command line RRS feed

  • Question

  • User338465 posted

    I have a Xamarin.Forms project meant to run on android and ios devices. The solution contains an iOS Unit tests project. At the moment I'm trying to figure out how to compile the iOS unit tests project from the command line. The idea is to run a build/test script on commit.

    However, when I try to build this project using msbuild it produces a .app folder without an executable in it. When I later try to install that .app on a simulator, the xcode simulator tools complain about not being able to chmod the executable. When I perform the same build from the IDE itself, everything works fine.

    Some pseudo code for the bash script:

    msbuild tests.csproj
    open /Applications/Xcode.app/Contents/Developer/Applications/Simulator.app/
    xcrun simctl install "$iosDevice" "bin/iPhoneSimulator/Debug/tests.app"
    

    The last install step complains with a message something like this:

    An error was encountered processing the command (domain=MIInstallerErrorDomain, code=4):
    Failed to chmod (long-file-path)tests.app/tests : No such file or directory
    

    There is a difference in build location when I use msbuild from the command line:

    // When I build from command line. This .app does not contain an executable.
    bin/iPhoneSimulator/Debug/tests.app
    
    // When I build from Visual Studio Mac IDE. This .app contains an executable.
    bin/iPhoneSimulator/Debug/device-builds/iphone9.1-10.3.1/tests.app
    

    How can I properly build an iOS unit tests project from the command line?

    Sunday, July 30, 2017 2:21 AM

All replies

  • User339045 posted

    This is an issue. We get Debug/test.app when building from IDE or command line and don't get device-builds unless building from IDE. How can this be resolved?

    Friday, June 26, 2020 2:01 PM