7

Trying to convert an existing MDAPI project into an SFDX project.

MDAPI Project is in ~/Documents/Workspace/TheProject and contains a src directory

From the ~/SFDX Projects directory in terminal I type:

sfdx force:project:create --projectname mytest

Output:

create mytest/sfdx-project.json create mytest/README.md create mytest/config/project-scratch-def.json

Look good so far

While in the MDAPI directory I type

sfdx force:mdapi:convert -r src -d ~/Documents/SFDC\ Projects/mytest

And bam, fail with

ERROR: This directory does not contain a valid Salesforce DX project.

▸ This directory does not contain a valid Salesforce DX project.

Not sure what is going on here as I am just starting to try and wrap my head around DX. I cannot get out of the gate it seems.

Anyone have some ideas or troubleshooting tips?

The contents of mytest directory are:

README.md
config
force-app
sfdx-project.json

and the project json is

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

in case it matters

1 Answer 1

12

Seems logic does not win here.

I thought that since I was in the MDAPI Project directory and specified the root and destination that it would be smart enough to understand what to do when performing sfdx force:mdapi:convert.

Well, guess not.

In order to convert a MDAPI project into an SFDX Project you MUST run the command from within the SFDX Project Directory

So running this command from the ~/Documents/SFDX\ Projects/mytest directory

sfdx force:mdapi:convert -r ~/Documents/Workspace/MDAPIProject

worked

2
  • The force:project:create command is meant to be run in the workspace folder to create the project. For example, Force.com IDE 2 calls this command internally to create the project. Once you realize that, you'll understand why you need to go into the project directory. It's not very well explained, as far as I can tell, but that's how it works.
    – sfdcfox
    Oct 15, 2017 at 2:56
  • @sfdcfox - The create command was done in the SFDX Project folder. It was the convert that did not work when running from the mdapi project folder. Maybe thats what you were saying that all commands need to be run from the sfdx project folder to work. I just found it odd that when specifying the root and destination that it choked. Wasted an hour or so trying to figure out why it was not working lol
    – Eric
    Oct 15, 2017 at 2:57

You must log in to answer this question.

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