1

When attempting to create a new Package Version, the following error message is reported.

We couldn’t create this package version because new components were added or existing components were deleted. Remove components {CustomObject=[myNewMetadata__mdt]} from the package version, and create the package version again.

I had added the myNewMetadata__mdt custom object since creating the previous version.

{
  "packageDirectories": [
    {
      "path": "force-app",
      "default": true,
      "package": "greeting",
      "ancestorVersion": "HIGHEST",
      "versionName": "ver 0.1",
      "versionNumber": "0.1.0.NEXT",
      "versionDescription": ""
    }
  ]
...
}

1 Answer 1

1

As the error noted, adding a component to the package version is not allowed. Reason for this is that I did not increment the package version number appropriately. Adding new components requires a minor version package bump (major.minor.patch.build). By changing my sfdx-project.json to the following, I was able to successfully create a new version.

{
  "packageDirectories": [
    {
      "path": "force-app",
      "default": true,
      "package": "greeting",
      "ancestorVersion": "HIGHEST",
      "versionName": "ver 0.1",
      "versionNumber": "0.1.0.NEXT",
      "versionName": "ver 0.2",
      "versionNumber": "0.2.0.NEXT",
      "versionDescription": ""
    }
  ]
...
}

You must log in to answer this question.

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