Debugging orchard themes

Tags: Orchard, theme, debugging

An orchard theme is a website with content, scripts, and styles; and views as .cshtml files. These are html with c# code embedded via the ASP NVC razor markup. I find these easy to change, but without running it, I also make mistakes, and one typo in the cde can prevent the whole site from running. So, running it in Visual Studio and debugging it is necessary. I did it like this:

You can open a theme in Visual studio as a web site, but that’s not much good. You can modify that markup easily, but you may want to test it out before pushing it to your website. For this you will want to debug it through orchard.

I got this working fairly quickly. The first step is to download and compile the orchard source. The orchard source contains themes, but on running Orchard via VS2010 only gives one installed theme – "The Theme Machine"

If you look under src\Orchard.Web\Themes you will see folders "TheThemeMachine" "TheAdmin" and "SafeMode", as well as folders for bin, obj and Properties.

If you drop your theme source in this folder, it will show up in the theme list. You can run the site and select it. You can include these files in the "Themes" project and get debugging!

I don't know if this is the "right" way but it seems to work well enough.

Add a Comment