Deploying a Specific Salesforce API Version using Visual Studio Code

Author: Bruce Tollefson Published: April 18, 2021; Modified: May 9, 2022

If you are using Visual Studio Code to deploy to Salesforce and come across an API Version specific error such as ‘Property ‘componentInstances’ not valid in version …‘ there are several options to try:

1. Change the Package.xml version

When deploying through the package.xml try changing the version(<version>xx.0</version>) to the specific version you need. Then deploy and see if that works.

2. Change the sfdx-project.json sourceApiVersion

If you aren’t using a package.xml you can try changing the sfdx-project.json “sourceAPIVersion” : “xx.0”

3. Use the CLI force:source:deploy –apiversion

If the above 2 doesn’t work you can use the CLI to with the following command:

$ sfdx force:source:deploy -x manifest/package.xml --apiversion xx.0

Leave a Reply

Your email address will not be published. Required fields are marked *