Error Importing SPM Module in Xcode While swift build and xcodebuild Works

Number:rdar://49890606 Date Originated:April 14 2019
Status:Open Resolved:
Product:Xcode Product Version:10.2
Classification:Developer Tools Reproducible:Always
When using Xcode, an error is given when importing a second target in the project even though swift build and xcodebuild still work.

Steps to Reproduce:
1) Create an SPM Project with this Manifest (or open attached project):
// swift-tools-version:5.0
import PackageDescription
let package = Package(
    name: "AnimalFarm",
    dependencies: [
        .package(url: "", .branch("master")),
        .package(url: "", from: "1.0.0"),
    targets: [
            name: "AnimalFarm"
            name: "AnimalFarmDiscord",
            dependencies: [
                .target(name: "AnimalFarm"),
2) swift package update
3) swift package generate-xcodeproj
4) Try importing AnimalFarm in AnimalFarmDiscord
5) Xcode fails to find module
6) build in the command line and it works

Expected Results:
Xcode to import the module as it does in the command line.

Actual Results:
`Error: No such module 'AnimalFarm'` at every import statement

10.2 (10E125)

Project autogenerated, so none.

Avoid Xcode and build only in the command line


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!