I created a package and now I want to create a dependent package. Let's say the parent package has a custom object: namespace__Application__c
In my child package, under the objects directory, I have:
namespace__Application__c/fields/
which is a directory of new fields to be added to the object.
When I try to install the package, I get the following error:
package.xml: Cannot add component of type:CustomObject named:namespace__Application__c subjectId:01IP0000000Iz59 to another package because it is an installed component.
The parent package is already installed and the child package gets compiled with no errors, but this happens when I try to install it.
I can only find one more result here but it's a different problem.
Details about the environment:
- Both packages are attached to the same dev hub
- Both packages created with this command:
sfdx force:package:version:create --package PackageName --path force-app --installationkey XXXXX --wait 10 --definitionfile config/project-scratch-def.json
- I'm trying to install them to a temporary scratch org - the parent package installs fine, the child package fails
Here's the sfdx-project.json
"packageDirectories": [
{
"path": "force-app",
"default": true,
"package": "ChildPackage",
"versionName": "ver 0.2",
"versionNumber": "0.2.0.NEXT",
"dependencies": [
{
"package": "[email protected]"
}
]
}
],
"namespace": "namespace",
"sfdcLoginUrl": "https://login.salesforce.com",
"sourceApiVersion": "47.0",
"packageAliases": {
"ChildPackage": "0HoXXX",
"[email protected]": "04tXXX",
... multiple versions of ChildPackage ...
"[email protected]": "04tXXX"
}
}```