I'm trying to package connectedApp using 2nd generation packaging as instructed here: https://salesforce.stackexchange.com/a/325175

However, the special xml file creates a conflict between scratch org and packaging.

If I add the offending file to .forceignore then it does not get included when creating new package version. However, removing it causes errors when pushing to the scratch org (note that I do not need it in scratch orgs, but it's ok if it's pushed).

1 Answer 1


There is not a clean solution for it and will have to workaround for now.

Option 1

Script your packaging command that modifies the .forceignore to remove the line where the connected app is mentioned.

Option 2

Using github branches you can maintain a packaging branch for packaging up the code which will not have the .forceignore with the connected app.

Obviously, 1st option is a lot better as it is less prone to manual errors as it is automated.

This needs to be reported to the packaging team so they give an elegant way to solve this out of the box and take care of not pushing the connected app to scratch org

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .