Error "The workspace contains multiple references with the same GUID"
Everytime I execute xcodegen in my project, and then build the iOS app, I receive the same error
Build service could not create build operation: unable to load transferred PIF: The workspace contains multiple references with the same GUID 'PACKAGE:1YPFJ9C2MTIAXFLQNBJR1G6455KB9KR79::MAINGROUP'
I always have to close and re-open Xcode in this case, which really hinders programming.
I don't really understand how this can even happen. xcodegen basically only rewrites the pbxproj-stuff without using internal xcode APIs like xcodebuild, right? So why does the build operation complain, does someone have an idea?
I also analysed the pbxproj-changes that xcodegen applies. The weird thing is, even if there are no changes at all (because I've executed xcodegen beforehand) then I also get the same error as before.
So if xcodegen doesn't use Xcode API (I suppose), and there are no changes to the .pbxproj-Stuff, what could xcode even complain about?
Do you have duplicate packages referenced in your project spec?
Only through transitive dependencies. We have an SPM-Package A that includes B, and we also have to include B ourselves in the project spec again to use it in the main app. And sorry for the late response, I haven't received any notification.
@yonaskolb
I've create a minimal "working" example here https://github.com/niklas-tag24/ExampleXcodegenIssue
@yonaskolb Have you already found the time looking at the minimal example I've provided?
Hi @niklas-tag24, I tried your project and could reproduce that generating while the project is open leads to the error Missing package product 'MyPackage'. I believe it's due to a long standing bug in Xcode https://forums.swift.org/t/missing-package-product-error-for-all-local-swift-packages-when-switching-git-branches/38041/54. Sorry I can't offer more help
Xcode just doesn't like when it's project changes out from underneath it, even in branch switching scenarios
Thank you for your reply. :) So it seems that the only "fix" would be to remove local packages from our app, right?