lemonmojo / mono_embedding_tool

This tool allows you to build an embeddable Mono.framework for macOS.
2 stars 0 forks source link

App Store release issues #1

Open DavidGrep opened 4 years ago

DavidGrep commented 4 years ago

Then I try release my app with embedded Mono.framework, I get the following errors from the App Store:

ITMS-90260: Bad Bundle Executable - You must include a valid CFBundleExecutable key in the nested bundle Mono [com.application_name.application_name-inc.pkg/Payload/Application.app/Contents/Frameworks/Mono.framework/Versions/A] property list file.
ITMS-90261: Bad CFBundleExecutable. Cannot find executable file that matches the value of CFBundleExecutable in the nested bundle Mono [com.application_name.application_name-inc.pkg/Payload/Appliction.app/Contents/Frameworks/Mono.framework/Versions/A] property list file.
lemonmojo commented 4 years ago

This was never intended to be used for releasing on the App Store so I didn't test for that case. Anyway, did you try adjusting the bundle executable key of the embedded Info.plist? Also did you check if it refers to the correct binary?

DavidGrep commented 4 years ago

@lemonmojo We use the info.plist that was generated by your tool. What we try to do: change value ofCFBundleExecutable to Mono, but it not help.

Screenshots for more details: Plist file:

Monosnap 2020-04-06 21-04-05

Project structure: image

lemonmojo commented 4 years ago

Maybe you need to point it to Versions/A/... instead of Versions/Current/... have you tried that?

DavidGrep commented 4 years ago

@lemonmojo it's don't help

lemonmojo commented 4 years ago

What error message do you get in that case?

DavidGrep commented 4 years ago

@lemonmojo i have the same issues: image

ITMS-90260: Bad Bundle Executable - You must include a valid CFBundleExecutable key in the nested bundle Mono [com.application_name.application_name-inc.pkg/Payload/Application.app/Contents/Frameworks/Mono.framework/Versions/A] property list file.
ITMS-90261: Bad CFBundleExecutable. Cannot find executable file that matches the value of CFBundleExecutable in the nested bundle Mono [com.application_name.application_name-inc.pkg/Payload/Appliction.app/Contents/Frameworks/Mono.framework/Versions/A] property list file.
DavidGrep commented 4 years ago

@lemonmojo I try just delete CFBundleExecutable key from info.plist, in this case I have only 1 error:

App Store Connect Operation Error
Bad Bundle Executable. You must include a valid CFBundleExecutable key in the nested bundle Mono [com.application_name.application_name.pkg/Payload/Application_name.app/Contents/Frameworks/Mono.framework/Versions/A] property list file.
lemonmojo commented 4 years ago

@DmitryKhali Well, unfortunately I can't really help you there as I have no experience with releasing on the Mac App Store.

Deleting CFBundleExecutable probably won't help as it's required. Have you checked your resulting bundle and if everything is really in the correct places?

DavidGrep commented 4 years ago

@lemonmojo Later I want to share with you the results of my searches, I managed to solve the problem about which I wrote above, maybe it will be useful for you)

But now your help is really needed - I need to sign Mono.framework/Version A/, but since symlink is created in the Mono.framework/Version/A/ folder, I can not sign Mono.framework/Version/A/, get error the main executable or Info.plist must be a regular file (no symlinks, etc.). If I just delete Mono.framework/Version/A/Mono symlink, signing is successfully, but I have another Error:

ld: framework not found Mono
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I just created libmonosgen dylib and marked it at the root of Mono.framework, but that doesn't help. You can help remove Mono symlink correctly from the Mono.framework/Version/A/Mono directory.

DavidGrep commented 4 years ago

Have solved problem above: I've delete symlink Mono.framework/Version/A/Mono, and create new Mono symlink in Mono.framework/. Error framework not found Mono not appear.

Now I have issues: 1) If I try to rename the NSBundleExecutable key to lib/monosgen-2.0, I have only one Error: image 2) if i try to rename the NSBundleExecutable key to Mono, i have this error: image

May be for validate it need some binary executable file?

lemonmojo commented 4 years ago

As previously mentioned, unfortunately I don't have experience with releasing Mono-based apps on the Mac App Store.

I just notarized an app which uses the embedding tool yesterday successfully. So this appears to be a MAS only issue.

DavidGrep commented 4 years ago

@lemonmojo did you successfully apply codesign -f -s to Mono.framework/Version/A/, and folder Mono.framework/Version/A/ contain Mono symlink?

DavidGrep commented 4 years ago

@lemonmojo Hmm, try to sign your Mono.framework without changing info.plist - it was successfully =) But how I understand, MAP have some requirements for Info.plist in key CFBundleExecutable but I can't understand what they need =(

All what I've found out info about CFBundleExecutable key here: https://developer.apple.com/documentation/bundleresources/information_property_list/cfbundleexecutable?language=objc They said:

For a framework, it's the shared library framework and must have the same name as the framework but without the .framework extension.

But then I've change key of CFBundleExecutable to Mono, I have sign error, therefore, in this case I point to symlink in Info.plist, but for them this is unacceptable for them

lemonmojo commented 4 years ago

Regarding codesigning: Yes, it definitely works as I wouldn't otherwise be able to pass Apple's notary service. It's however a bit more involved than the invocation you posted.

In my post build script, I sign the Mono.framework like this:

DEV_ID="My Dev ID"
ENTITLEMENTS=${PROJECT_DIR}/DubLibTestApp/DubLibTestApp.entitlements

codesign --force --strict --timestamp -o runtime --entitlements "${ENTITLEMENTS}" -vvvv --sign "${DEV_ID}" "$TARGET_BUILD_DIR/$PRODUCT_NAME.app/Contents/Frameworks/Mono.framework/Versions/A/lib/libMonoPosixHelper.dylib"
codesign --force --strict --timestamp -o runtime --entitlements "${ENTITLEMENTS}" -vvvv --sign "${DEV_ID}" "$TARGET_BUILD_DIR/$PRODUCT_NAME.app/Contents/Frameworks/Mono.framework/Versions/A/lib/libmonosgen-2.0.dylib"
codesign --force --strict --timestamp -o runtime --entitlements "${ENTITLEMENTS}" -vvvv --sign "${DEV_ID}" "$TARGET_BUILD_DIR/$PRODUCT_NAME.app/Contents/Frameworks/Mono.framework/Versions/A/lib/mono/4.5/libSystem.Native.dylib"
codesign --force --strict --timestamp -o runtime --entitlements "${ENTITLEMENTS}" -vvvv --sign "${DEV_ID}" "$TARGET_BUILD_DIR/$PRODUCT_NAME.app/Contents/Frameworks/Mono.framework"
lemonmojo commented 4 years ago

For a framework, it's the shared library framework and must have the same name as the framework but without the .framework extension.

Well, this pretty much explains the issue. The executable must be named the same as the framework's name but without the .framework. This is not the case here. If you change it to reflect that restriction, the first issue goes away but then you have the next issue which is that symlinks are not allowed for the main executable. So you could probably get rid of the problem by placing a copy of libmonosgen-2.0.dylib named just Mono in the root of the bundle but that would obviously double the space required for storing just a single copy of libmonosgen-2.0.dylib.

DavidGrep commented 4 years ago

Thanks) Now try to do it =) Additionally, find out some useful information about CFBundleExrcutable key: image link: https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html#//apple_ref/doc/uid/20001431-101909