XCodeBuild is not picking a configuration from my workspace

ios, xcode, xcodebuild

Solution

It's impossible to configure target for workspace. You can create a scheme based on a particular target and then build a project passing scheme name. Setting configuration via '-configuration' switch works fine for me. I use xcode v. 5.0.2.

In general a configuration is set via action. You can create multiple schemes for archiving (with different configurations) and there's no need to pass configuration at all. Default configuration will be taken.

Problem

This is my build command ``` xcodebuild -workspace MyApp.xcworkspace \ -scheme MySchemeName \ -configuration AdHoc \ clean archive ``` It works but its uses the default configuration for the archive scheme (which is `release`) instead of `AdHoc` which I specified. In fact if you specify `-scheme ASchemeNameThatDosnNotExist` it still works and silently ignores the configuration name. The project is setup like this: ``` xcodebuild -list ``` ``` Targets: MyApp MyAppTests Build Configurations: Debug AdHoc Release If no build configuration is specified and -scheme is not passed then "Release" is used. This project contains no schemes. ``` And the workspace like this: ``` xcodebuild -workspace MyApp.xcworkspace -list ``` ``` Schemes: MyApp Pods Pods-AFNetworking .. More pods ``` I.e. There are no targets and no configurations in the workspace. How do I make a target visible to the workspace? Or is there another way?

Original source