The error message from xcode app installation sometime can be very misleading, I have aligned the entitlements many times, but the root cause is not because of that, it is because I have changed the certificate and my build pipeline script was using wrong certificate SHA value:
/usr/bin/codesign --force --sign 701BB03735D5960C855D6E79223414F93F40065E --entitlements $workspace/xxx.app.xcent --timestamp=none $workspace/xxxx.app
for my case, nothing's wrong with my entitlement file, it is because 701BB03735D5960C855D6E79223414F93F40065E
is wrong, but the error message always print out as The executable was signed with invalid entitlements
. Wasted my whole day for this.