I have this folder/file in my dx project:


The file HealthCloudGA.installedPackage-meta.xml contains the following:

<?xml version="1.0" encoding="UTF-8"?>
<InstalledPackage xmlns="http://soap.sforce.com/2006/04/metadata" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

What's awesome about doing this is when I push my source to a scratch org, it automatically installs the manage package.

My problem is the manage package has different version numbers in different environments. For example, if the version number is 232.0 in my sandbox, but 232.1 in my source, when I push the source to my sandbox, it attempts to install the latest version. This is really time consuming cause I don't care to have the latest version when deploying source between different environments. Is there anyway to put in my metadata to use the current version if manage package is installed in the org and use the latest version when it's not installed?

1 Answer 1


No, you can't conditionalize InstalledPackage metadata. The Metadata API just installs what you specify.

The situation where you have a disparity in installed versions

the version number is 232.0 in my sandbox, but 232.1 in my source

seems like a significant risk to me. Your development environments ought to match the environment into which the developed code is going to be deployed, i.e., version 232.0.

I'd suggest treating the installed package version just like any other change you are developing and versioning: update the version only when you actually intend to install that new version in your persistent environment.

  • Thanks for your thoughts and I completely agree with you. It's just frustrating that these new version numbers happen automatically. Which means I need automate updating the new version in my source, or do it manually :(
    – Tyler Zika
    Jul 23, 2021 at 19:10

You must log in to answer this question.

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