This project is read-only.

Error executing command "codegen theme mynewtheme"

Topics: Customizing Orchard, General, Troubleshooting
Nov 4, 2012 at 6:32 PM
Edited Nov 4, 2012 at 6:33 PM

Cannot get codegen to work properly via the console.

This is orchard 1.6 installed through web platform installer and running through webmatrix, using the 'default' install option. I've done nothing except set some basic options and create some pages - all through the admin system - not even touched it in visual studio yet.

Have ensured that codegeneration is enabled first, then run the command, and it keeps failing. Have tried disabling then re-enabling but hasn't helped, and tried disabling and re-enabling via the admin gui, again, same problem.


orchard> feature enable Orchard.CodeGeneration
Enabling features Orchard.CodeGeneration
Code Generation was enabled

orchard> codegen theme mynewtheme /CreateProject:true /IncludeInSolution:true /BasedOn:TheThemeMachine

Error executing command "codegen theme mynewtheme"

No command found matching arguments "codegen theme mynewtheme". Commands availabl
ate,theme list,theme activate,layer create,widget create,menuitem create,menu cre
feature enable,feature disable,package create,package install,package uninstall,p
e,user create,warmup generate,cultures list,cultures get site culture,cultures se



I had a look in the error log, and there's nothing in there - is there a debug switch I need to enable? Can anyone suggest some more stuff for me to try?

Nov 4, 2012 at 9:25 PM

I just tested it with WebMatrix 2:

  1. Installed a new Orchard instance from the gallery
  2. Setup the site using the "Default" recipe
  3. Installed the CodeGeneration module from the gallery and enabled the Code Generation feature
  4. Started Orchard.exe and executed the command "codegen theme mynewtheme /CreateProject:true /IncludeInSolution:true /BasedOn:TheThemeMachine"
  5. Received the message: "Theme mynewtheme created successfully"

No special steps were necessary.

Perhaps try again from scratch?


Nov 4, 2012 at 9:59 PM

Ok, I can create a new one from scratch for now.

I'd much prefer to be able to get some insight into what the problem is. Is there no simple way I can debug this? Like a verbose mode from the console or an event log which shows what's going wrong?

I'm quite happy to have a dig around to see if I can work out what's failing, just don't know where to start - any suggestions?

Nov 4, 2012 at 10:32 PM

I suppose you could start by attaching the debugger and set some breakpoints in the "DefaultOrchardCommandHandler.Execute" method and find the code that is responsible for mapping command names. In addition, you could open the database and inspect the values of the "Features" tables (don't know the names from the top of my head).

Nov 7, 2012 at 1:21 PM
Edited Nov 7, 2012 at 1:30 PM

I'm new to Orchard and am seeing the same thing. This is a pretty major issue because one of the first things that a lot of people are going to do is try and create a new theme. Anyone with Orchard experience have a workaround?

PS. I noticed that unlike all the other modules, after installation CodeGeneration has no bin directory?

Nov 8, 2012 at 5:34 AM

The bug has been filed. Workaround is to copy an existing theme.

Nov 20, 2012 at 6:08 PM

I too am having the same problem. 

I downloaded 1.6 via Web Platform Installer > Selected Default install.  Didn't configure anything, except install Code Generation from the gallery and enabled it via admin GUI.

I've gone through creating a new instance from scratch, enabling/disabling Code Generation through both UI and CLI, but still do not see codegen under the command list.

Nov 21, 2012 at 5:25 PM

Ok, I found a work around for this based on what jonbprime had discovered. Since CodeGeneration does not have a bin directory as all the other modules do, I used visual studio 2010 to open up Orchard.CodeGeneration.csproj. After it was loaded into the solution, I built the project which generated a /bin directory. I went back to the console and saw codegen as part of the command list.

Dec 5, 2012 at 11:20 PM

Experiencing the same problem, I solved it by installing .Net framework 4.5