Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build dmg and MAS with different CFBundleIdentifier #7570

Closed
GabrielNSD opened this issue May 9, 2023 · 6 comments
Closed

Build dmg and MAS with different CFBundleIdentifier #7570

GabrielNSD opened this issue May 9, 2023 · 6 comments
Labels

Comments

@GabrielNSD
Copy link
Contributor

  • Electron-Builder Version: 23.6.0
  • Node Version: 14.21.3
  • Electron Version: 20.3.0
  • Electron Type (current, beta, nightly):
  • Target: dmg, zip and mas

Hi there! I have an app that is currently just distributed by .dmg files. I use the electron-update to provide updates for the users.
Now we want to publish the app in the App Store, for doing so the CFBundleIdentifer must match with the one already registered in the App Store. The problem is that we have been releasing the app with a different appId.
Just changing the appId to the new one will break the update for the installed .dmg.
My idea is to keep keep building the dmg using the old id and build the MAS using the "new" id.
I have tried doing that by change my build configuration, either by using extendInfo in the mas key and add the key CFBundleIdentifier with the new id, what makes the .pkg file being able to upload by transporter, but making dmg impossible to update since it also changes the Info.plist of the .zip. Or tried to put the CFBundleIdentifier key directly in the entitlements.mas.plist file, which had no effect :/.
Here is part of my json file with build configuration:

{...
    "mac": {
      "icon": "src/assets/icons/icon.icns",
      "appId": "com.old-id.app",
      "category": "public.app-category.education",
      "target": [
        "dmg",
        "zip",
        "mas"
      ],
      "files": [
        "entitlements.mac.plist",
        "entitlements.mas.plist"
      ],
      "hardenedRuntime": true,
      "entitlements": "entitlements.mac.plist",
      "extendInfo": {
        "NSMicrophoneUsageDescription": "Please give us access to your microphone"
      }
    },
    "mas": {
      "entitlements": "entitlements.mas.plist"
    },
...}

Is there a way to achieve this? Keep the old CFBundleIdentifier in the .zip file and use the new id only for the MAS (.pkg)?

@mmaietta
Copy link
Collaborator

mmaietta commented May 9, 2023

I think you can set bundleVersion uniquely on mac and mas targets, and that should override the CFBundleVersion to be different per platform. I'm just running off of memory here though, don't have the code handy to check the behavior.

@GabrielNSD
Copy link
Contributor Author

Hi @mmaietta , thank you for the answer. As far as I understood, the CFBundleIdentifier is the key used by electron-updater to locate the bundle that is eligible to update. The bundleVersion overrides the CFBundleVersion, which I am not having trouble

@mmaietta
Copy link
Collaborator

Whoops, my bad, I misread.

In that case, I think you should be able to specify appId in mas target to customize that.

@GabrielNSD
Copy link
Contributor Author

Unfortunately, specifying appId in mas target does not change the CFBundleIdentifier of the packaged MAS, it still uses the appId from the mac key.

@github-actions
Copy link
Contributor

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

@github-actions github-actions bot added the Stale label Jun 15, 2023
@github-actions
Copy link
Contributor

This issue was closed because it has been stalled for 30 days with no activity.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jul 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants