Xcode 13 "Missing package product" using local Swift Packages

I have a project I've been working off of for a few years now that makes use of local Swift Packages. In my workspace, I have a "Kit" project that generates a framework using several local Swift Packages as dependencies.

In Xcode 12, the local Swift packages resolve correctly and compiles, but each beta of Xcode 13 gives me the error: "[ProjectName].xcodeproj Missing package product '[LocalSwiftPackage]'"

Clearing the package cache, derived data, or restarting the application does not resolve the issue. Only Swift Packages that are remotely loaded from a URL are compiled correctly.

Using local packages to separate module code, while still being able to edit in the same project, has been essential to my workflow and would hate to see Xcode 13 release with these breaking changes, and I have not seen this issue listed in the known issues for the Xcode 13 release notes.

Has anyone else experienced this issue or found a workaround?

Answered by neur0 in 686686022

Check if Xcode 13 resides in Application folder. In my case it was in Downloads folder, moving it to Application folder solved the problem for me.

In my case, the error occurred because for one of my packages, they moved from using the master branch nomenclature to the main branch nomenclature, and in my project, it was set to the master branch. Changing this fixed all my outstanding issues. Xcode 14.2

I have also been having this issue with Xcode 15.4 (release candidate, 15F31c). I'm coding for the VisionPro, and the RealityKitContent (where I put all the bundled usdz files) was marked as missing package. Specifically that the Package.swift was innaccessible as it was not present in the file system. However, I could clearly see it & read it in Finder & Xcode's file browser part.

I tried moving Xcode to Applications, which may have fixed it briefly, but the next day the same problem was happening. I tried re-adding the Package manually, but that didn't help, it even complained about adding it because it was not present (same problem as above).

However, I eventually worked around it by deleting the git repository completely & re-cloning from my remote copy. I am now back in & it compiled. I just really hope it doesn't do it frequently, as that would be a major pain.

The fact that this bug that's related to the core features of the SPM still exists after several versions of the IDE is mindblowing. Whenever I change branches, it starts to update dependencies altough all branches have the same .resolved file in them and failing to do so randomly is extremely frustrating. Closing Xcode before switching branches doesn't always work either. I have to randomly try resetting package caches multiple times and restarting the IDE several times to make it work again. A collosal waste of time.

Xcode 13 "Missing package product" using local Swift Packages
 
 
Q