Compile errors with package in Release mode w/CoreData resources

I get a ton of compile errors when I compile in Release mode (i.e. Archive) my swift package that contains my CoreData .xcdatamodel file.

Works fine in debug mode, but when archiving, I get tons of “error reading dependency file…unexpected character in prerequisites at position…” errors.

Same errors as this issue: https://developer.apple.com/forums/thread/657264

If I move the .xcdatamodel to the main project (out of the package), then it's all good again, but I'd like to keep the database model file inside the package if possible.


Did you manage to solve this? I am experiencing the same issue
I had the same issue and managed to fix it after finding out more about what's causing the issue here: https://github.com/AudioKit/AudioKit/issues/2279#issuecomment-705285458

So my problem was that I had the Core Data model files (.xcdatamodeld directory and the .xcdatamodel file within that directory) called after the package name but I also had the main source file called the same as the package name (eg: MyPackageName.xcdatamodel and MyPackageName.swift), and the fix was to rename the Core Data model files (.xcdatamodeld directory and the .xcdatamodel file within that directory) to Model.xcdatamodeld and Model.xcdatamodel and that was it.

Thanks to arturgrigor, I finally solved my issue too! The problem definitely was the package name being the same as the .xcdatamodeld file name (or vice versa…). Changing one of those made my Release build successful…! 🥳
Compile errors with package in Release mode w/CoreData resources
 
 
Q