'Local Swift Packages Stopped Working in Xcode 13

I've local Swift Packages added to a workspace. They reside in the project subfolders and connected to different git repositories as git submodules. Everything had been working perfectly (the project was able to build, packages were able to resolve, and I could edit the packages within the same workspace).

After I updated Xcode to 13.0, the project started failing to build with multiple errors Missing package product for each local package dependency. Removing derived data, resetting packages, cleaning build folder and restarting Xcode didn't help.



Solution 1:[1]

  1. Quit Xcode

  2. Open Terminal

  3. Navigate to the directory where your .xcodeproj is via Terminal (cd path/to/your/apps/folder)

  4. Run xcodebuild -resolvePackageDependencies

  5. After the packages finish resolving, open Xcode and try building again.

Solution 2:[2]

This is what worked for me:

  • Click on the project file then go to Project (not a target) -> Package Dependences tab.
  • Double-click on any Package and copy the location URL to clipboard.
  • Remove that Package using the - button.
  • Add it back, pasting the URL.
  • Clean Build Folder, then Build.

Alternatively, removing an unused package in the Target -> Build Phases -> Link Binary With Libraries, also removed the errors for me.

Solution 3:[3]

If @lazarevzubov's answer doesn't help, try few additional steps:

  • Open xcode
  • Delete one or couple of libs under Build Phases / Link Binary with Libraries
  • Discard changes under git
  • Clean project
  • Close xcode
  • Run xcodebuild -resolvePackageDependencies
  • Open xcode again and try to build

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Daniel Storm
Solution 2
Solution 3 Eric Aya