Creating data migration failed: target Feature *** could not be found

Oct 24, 2010 at 4:29 AM

I downloaded the lateset build, orchard-2788148403d9, and I'm following this article,, to create a module.

The following command throws an error as stated in the title, Creating data migration failed: target Feature *** could not be found.

codegen datamigration *** 

I followed all the steps and just replaced "scaffolding create" with "codegen". Did something change for datamigration or is the article missing a step?

Any help or thoughts are appreciated.


Oct 24, 2010 at 4:56 AM

The documentation is currently out of sync with the implementation. We are working on updating it. You can get the list of commands by doing "help commands" and you can get usage information for a specific command by doing "help NameOfTheCommand".

Jan 14, 2011 at 9:55 PM

I follow the tutorial and check sintax with help commands (help NameOfTheCommand doesn't work)

codegen datamigration Maps

throw an error "Creating datamigration failed: target feature Maps could not be found"

Jan 14, 2011 at 10:23 PM

mmh. Help definitely works:

orchard> help codegen datamigration
codegen datamigration <feature-name>
        Create a new Data Migration class

I've redone the whole tutorial and it works fine for me:

orchard> codegen datamigration Maps
Creating Data Migration for Maps
Data migration created successfully in Module Maps

You probably have a mistake in the name of the module, or you haven't installed the code generation module, or something similar. Please try again by following the tutorial very closely.

Jan 14, 2011 at 10:37 PM
Edited Jan 14, 2011 at 10:38 PM

Maps is the name of the module that exist in Modules solution folder after I created with command: 
codegen module Maps /IncludeInSolution:true

Double clicked on Orchard application in bin directory (I did not found any details about Orchard app in the tutorial... I know, it's not up to date). And with this command:
codegen datamigration Maps

I obtain the following error:
Creating datamigration failed: target feature Maps could not be found

Jan 14, 2011 at 10:48 PM

Did you read this? I'm asking because your saying that you double-clicked Orchard in bin sounds suspicious.

Jan 15, 2011 at 11:30 AM

No, I didn't read. I suggest to insert a link to relevant documents in a tutorial.

Anyway, I try to launch Orchard.exe from the root web site directory with bin/Orchard.exe but without success. I obtain the same error.
I digg into your codegen code and I found this code:

ExtensionDescriptor extensionDescriptor = _extensionManager.AvailableExtensions().FirstOrDefault(extension => DefaultExtensionTypes.IsModule(extension.ExtensionType) &&
                                                                                                             extension.Features.Any(feature => String.Equals(feature.Id, featureName, StringComparison.OrdinalIgnoreCase)));

            if (extensionDescriptor == null) {
                throw new OrchardException(T("Creating data migration failed: target Feature {0} could not be found.", featureName));
but if a call 

feature list /summary:true
There isn't the Map feature in the list. Maybe something goes wrong during the creation? then...
I removed Maps.
I recreated it with: codegen module Maps /IncludeInSolution:true With "feature list" command the module appears into the results.
As "closely" from the tutorial I changed the file Module.txt with the corresponding text from the tutorial. With "feature list" command the module disappear from the results.
Aug 11, 2011 at 9:52 AM

I had the same problem. But fixed it by reediting the module.txt. Problem might be that I copy-pasted the content from the tutorial website and some inconvenient characters for newline or tabs were included in the content. Dunno, but by editing the content manually the creation of datamigration worked.