When you use the command line interface in Orchard to generate a module, it seems you cannot use the context menus to create views and you end up manually creating the *.cshtml files. That is when you right click on the project and select “Add” there’s no “View…” option.

This is because the project type isn’t being set correctly by the Orchard code generator.

You can enable the context menus by:

  1. Edit the module’s project file (*.csproj)
    image
  2. Change the ProjectTypeGuids XML Node from:
    <ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
    To:
    <ProjectTypeGuids>{E53F8FEA-EAE0-44A6-8774-FFD645390401};{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
  3. Reload the project

Now you will get the option to create a view from the Add context menu

image

5 Comments