 		case let .ProjectFile(URL):
 			assert(URL.fileURL)
 			return URL
+		}
+	}
+
+	/// The arguments that should be passed to `xcodebuild` to help it locate
+	/// this project.
+	private var arguments: [String] {
+		switch (self) {
+		case let .Workspace(URL):
+			return [ "-workspace", URL.path! ]
+
+		case let .ProjectFile(URL):
+			return [ "-project", URL.path! ]
 		}
 	}
 }

public func buildInDirectory(directoryURL: NSURL, configuration: String = "Release") -> Promise<Result<()>> {
	precondition(directoryURL.fileURL)

	let directoryPath = directoryURL.path
	let desc = TaskDescription(launchPath: "/usr/bin/xcrun", arguments: [ "xcodebuild", "build" ], workingDirectoryPath: directoryPath)

	return launchTask(desc).then { status in
		return Promise { sink in

/// Attempts to locate a project or workspace within the given directory.
public func locateProjectInDirectory(directoryURL: NSURL) -> Result<ProjectLocator> {
	let enumerationOptions = NSDirectoryEnumerationOptions.SkipsHiddenFiles | NSDirectoryEnumerationOptions.SkipsPackageDescendants

	var enumerationError: NSError?
	let enumerator = NSFileManager.defaultManager().enumeratorAtURL(directoryURL, includingPropertiesForKeys: [ NSURLTypeIdentifierKey ], options: enumerationOptions) { (URL, error) in
		enumerationError = error
		return false
	}

	if let enumerator = enumerator {
		var matches: [ProjectEnumerationMatch] = []

