Packages Not Supported with Legacy Build Locations
• 2 minute read
When I was messing around with Xcode build settings I summoned the tenacious error of unsupported Swift packages in combination with legacy build locations.
In my project I have multiple app bundles as build products. Some have the same name. To avoid name conflicts in the temporary build folder I wanted to get them into subfolders as a method of namespacing. I think it was the “Executable Prefix” build setting under “Packaging” for one target which had an undesired and not obvious side effect. Xcode started to report the following error and I did not know why:
Packages are not supported when using legacy build locations, but the current project has them enabled.
I also noticed that Xcode started to work in a folder named
build inside my project folder.
What usually took place in
~/Library/Developer/Xcode/DerivedData suddenly happened here.
I thought it is one of those hiccups again and cleared the default “DerivedData” folder to no avail. Reversion of my changes did not help either. Even in combination with a reboot (sometimes that helps because some information is cached by some process in memory).
Then I turned to experimenting with the rarely-thought-of project settings. They offer advanced settings concerning the build system and locations to use. It was a dead end, too. I was out of ideas where Xcode suddenly had the idea of using legacy build locations.
Finally, I remembered there is some user data inside the Xcode project which is ignored by version control in my case. Thus, the changes inside were not visible to me.
The solution was to close Xcode and delete the following folders inside my project folder:
Then I reopened Xcode and it finally fell back to previous build behavior.