Packages Not Supported with Legacy Build Locations

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:

./Example.xcodeproj/project.xcworkspace/xcuserdata
./Example.xcodeproj/xcuserdata

Then I reopened Xcode and it finally fell back to previous build behavior.

About The Author

Peter Thomas Horn is a professional software developer at Open-Xchange specialized on the Apple platform. He previously worked a decade across the full stack of various web technologies. Originally started with Java on Windows at the age of 12 years. While staying humble in throwing around buzzwords like "VR" and "machine learning" he occasionally experiences problems and the fitting solutions considered worth sharing.