7

For Salesforce DX, after downloading code from an Unmanaged Package to push to a Scratch Org, when I try to convert the unzipped package I am getting an error saying that

Unexpected file found in package directory: .../package.xml.

I "retrieve" the code from an Unmanaged Packaged in a Sandbox org into a top level directory of my Salesforce DX project called "mdapipkg". I have added this as a path in the sfdx-project.json file. Upon the "convert" command, specifying this directory, I get this error.

I do not understand why it is telling me that the package.xml is unexpected, as it is a typical part of the downloadable zip from an Unmanaged Package.

Has anybody come across this issue?

2 Answers 2

6

I came across the solution reading this post: https://developer.salesforce.com/blogs/developer-relations/2017/07/migrating-existing-projects-salesforce-dx.html.

Apparently you cannot delete the .zip before you convert the files. You have to do it after.

1
  • Fwiw, I ran into this problem and it doesn't appear that the order of deletion of the zip affected things. For me, the problem seemed to be that I was trying to run the convert from a place other than the project root. Commented Dec 19, 2017 at 7:05
4

In my case the problem was with project's configuration file: sfdx-project.json and packageDirectories attribute.

It looked like this:

{
  "packageDirectories": [
    {
      "path": "force-app",
      "default": true
    },
    {"path": "mdapipkg"}
  ],
  "namespace": "",
  "sfdcLoginUrl": "https://test.salesforce.com",
  "sourceApiVersion": "42.0"
}

I added mdapipkg directory to packageDirectories because I thought it will help me with some sfdx force:mdapi commands but it didn't and caused such problems. It was first complaining about package.xml than about unpackaged.zip file. Once I removed that folder from sfdx-project.json convert command did the work!

You must log in to answer this question.

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