0

Is it possible to delete an Apex class from an unlocked package?

I have deleted a class from the sfdx project for an locked package. Then I've successfully created the new package version.

However, when I deploy the package to the new org, I am getting Apex compile failure error messages telling me that the Apex class that I have just deleted can't find some references and types that were in the old package, and are not in the new one.

Perhaps I need to uninstall the old package version from the environment before reinstalling the new one?

2
  • Is it unlocked, or unmanaged package? Sep 9, 2021 at 8:58
  • @OleksandrBerehovskyi Ah. It's a 2nd Generation Unlocked package. Thanks. I will edit.
    – lemming
    Sep 9, 2021 at 9:10

1 Answer 1

2

You can use the --upgradetype Delete in your force:package:install command.

Documentation in here: https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_unlocked_pkg_install_pkg_upgrade.htm

1
  • Thanks a lot :)
    – lemming
    Sep 9, 2021 at 14:14

You must log in to answer this question.

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