Only default commands available in recipe?

Topics: Troubleshooting, Writing modules
May 17, 2011 at 1:45 PM

It seems it isn't possible to provide own commands to a recipe at the moment, at least it doesn't work on my pc.
I wanted to create a recipe with our modules enabled and calling commands in that module.

Let say my i've a custom module named "helloworld" with feature "helloworld"
providing a command named "foo"

I want my feature enabled 
  <Feature enable="Orchard.Lists,TinyMce, Helloworld
...



then call the command in that module
  <Command>
      foo do bar
..

It will just throw an exception when cooking the recipe

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: Orchard.OrchardCoreException: Recipe execution with id 7a498bbcb4a7467e85d4b908acde022b was cancelled because the "Command" step failed to execute. The following exception was thrown: No command found matching arguments &quot;foo do bar&quot;. Commands available: cultures list,cultures get site culture,cultures set site culture,help commands,help,user create,recipes harvest,recipes execute,page create,package create,package install,package uninstall,feature list,feature enable,feature disable,update database,create tables,upgrade database,codegen datamigration,codegen module,codegen theme,codegen controller,menuitem create,widget create,layer create,theme list,theme activate.. Refer to the recipe journal for more information.

Source Error:

Line 83:                     parameters.Add(arguments[methodParameter.Name]);
Line 84:                 }
Line 85:                 var result = method.Invoke(eventHandler, parameters.ToArray());
Line 86:                 returnValue = result as IEnumerable;
Line 87:                 if (returnValue == null && result != null)


May 17, 2011 at 2:04 PM

This should work; the simple reason being that ordinary Orchard features also get enabled by the recipe and their commands work. Orchard modules are in no way different or somehow more "special" than your modules ;)

So the things to check are:

a) Is your feature definitely getting enabled

b) Does your command work ordinarily from the command line

Can you paste in your command's code as well so I can check there's nothing wrong with it?

May 17, 2011 at 3:02 PM
Edited May 17, 2011 at 3:03 PM

Lol... I really have no clue what i've done wrong, i did the exact coding again and now it works

Ignore this topic please :)