When we do the converting of Salesforce DX code into metadata, we usually want to exclude the profile and layout files.

To achieve this, I usually need to manually delete all the layout and profile files. This is a very flaky mechanism based on me remembering to delete them.

Is there a better way to exclude those folders? I have tried forceignore file but it doesn't seem to work.

  • Create a .forceignore for at the root of your project and exclude relative to that. More documentation: developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/… Commented Feb 14, 2018 at 5:26
  • @TheSFDCTower strange... I do add the line: force-app/main/layouts in my .forceignore file. But it still seem to have added the layouts into the output folder.
    – Lance Shi
    Commented Feb 14, 2018 at 5:37
  • Check the doc for examples, did you add a '*' to the end of the path? Commented Feb 14, 2018 at 5:45
  • 1
    .forceignore is only for force push and pull commands .Do not think it applies to metadata convert command Commented Feb 14, 2018 at 6:07
  • 1
    From the doc: "Add the file(.forceignore) to the Metadata retrieve directory (with package.xml) for force:mdapi:convert." Commented Feb 14, 2018 at 17:28

1 Answer 1


My read of the documentation is that the .forceignore file mentioned by others is only when you're pushing and pulling to the scratch org or converting from mdapi TO DX, not the other way around.

I was annoyed about the seeming lack of functionality, but I think that's part of why they built the sfdx tool. For our team where we just ran into this, I'm writing a bash script (but it could be written in anything) that will copy the DX force-app code tree to something like mdapimidway, prune out the files we don't want to convert and deploy and then call the convert command with the midway tree as the source to convert

sfdx force:source:convert -r mdapimidway/ -d mdapioutput/

The real power of DX isn't that it has functional parity with other tools, it's that you can throw it into the middle of your own scripts to take care of all the things they didn't think of.

You must log in to answer this question.

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