So finally I found a way to fix the wrong behavior of the Xcode build and archive process ...
The following script snippet patching the wrong files to the right one.
# Type a script or drag a script file from your workspace to insert its path.
# NOTE!!! -> Paste the script into Xcode Build Phase - custom build script
# Input files:
# ---> ${SOURCE_ROOT}/../../Entitlements.plist
# ---> ${SOURCE_ROOT}/../../DRFXBuilder.app.xcent
# Output files:
# LEAVE EMPTY
echo "-------- PATCH WRONG ENTITLEMENTS ---------"
echo "-- build env"
printenv
##--
mkdir -p ${BUILD_ROOT}/DRFXBuilder.build/Debug/DRFXBuilder.build/DerivedSources
cp -pv ${SOURCE_ROOT}/../../Entitlements.plist ${BUILD_ROOT}/DRFXBuilder.build/Debug/DRFXBuilder.build/DerivedSources/Entitlements.plist
cp -pv ${SOURCE_ROOT}/../../DRFXBuilder.app.xcent ${BUILD_ROOT}/DRFXBuilder.build/Debug/DRFXBuilder.build/DRFXBuilder.app.xcent
##--
mkdir -p ${BUILD_ROOT}/DRFXBuilder.build/Release/DRFXBuilder.build/DerivedSources
cp -pv ${SOURCE_ROOT}/../../Entitlements.plist ${BUILD_ROOT}/DRFXBuilder.build/Release/DRFXBuilder.build/DerivedSources/Entitlements.plist
cp -pv ${SOURCE_ROOT}/../../DRFXBuilder.app.xcent ${BUILD_ROOT}/DRFXBuilder.build/Release/DRFXBuilder.build/DRFXBuilder.app.xcent
##--
mkdir -p ${TARGET_TEMP_DIR}/DerivedSources
cp -pv ${SOURCE_ROOT}/../../Entitlements.plist ${TARGET_TEMP_DIR}/DerivedSources/Entitlements.plist
cp -pv ${SOURCE_ROOT}/../../DRFXBuilder.app.xcent ${TARGET_TEMP_DIR}/DRFXBuilder.app.xcent
Topic:
Code Signing
SubTopic:
Entitlements
Tags: