Orchard CMS Quick Tip–Curling up with Orchard, or brace line breaks without ReSharper

Posted on: Wednesday, 30 September 2015 09:30

Orchard CMS requires that all commits to the core use the JavaScript style curly brace positioning, where the opening brace is on the same line as the method signature. If you use ReSharper then it comes with an automatic .resharper file that applies this out-of-the-box but non-users can still get this functionality with plain vanilla Visual Studio.

Orchard CMS Quick Tip–Getting at the Orchard.Layouts JSON for your template defaults

Posted on: Tuesday, 29 September 2015 09:00

If you have started using the Orchard.Layouts module which has seen some pretty significant updates in the last few releases you might be wondering how you get at the JSON data that you’ve been finding in content part default layout data setting. There are two ways but both are a bit tricky.


It’s been pointed out to me by several people that this technique doesn’t work any more. I don’t know an alternative way to solve this, sorry.

What do I mean exactly?

When you have a LayoutPart attached to one of your content items you will see a section like this in its Content Definition page:


This data pre-populates the page when you create a new content item.

If you want to customise your own content types with LayoutParts that come with defaults its possible but their currently there isn’t anyway to access this through the admin panel directly. Instead you need to take one of the two courses listed below.

XML export

The first option is to export the data using the import/export module that comes with Orchard CMS. You can so it this way but then you will get the JSON data in xml encoded format so it will need extra processing.

Access the clipboard data

(Special thanks to Daniel Stolt, one of the core Orchard.Layouts developers, for this idea)

In Chrome you can select an element, hit Ctrl+C and then that JSON data is actually placed on the system clipboard, along with the plain-text of the element. It's how copy-paste works.

The trouble is that you probably don’t have an application installed that will paste clipboard data with the type “Chromium Web Custom MIME Data Format” so if you try to paste it back again all you will get is the plain text representation.

To get at this data you can use LINQPad to extract this hidden JSON data:


Just follow these simple steps:

  1. Download LINQPad 4
  2. Paste this query into the query window:

    var s = (System.IO.MemoryStream)System.Windows.Forms.Clipboard.GetData("Chromium Web Custom MIME Data Format");
  3. Set the Language to C# Statement(s) for multiline support. Note the (s) on the end.

  4. Query > Query Properties > Additional References > Add > Search Forms > Add System.Windows.Forms.dll reference > OK
  5. Run the query
  6. Bonus tip: File > Save to save the snippet for next time. You can load it back from the My Queries tab in the bottom corner.

Troubleshooting - NullReferenceException: Object reference not set to an instance of an object.

You copied something else into the clipboard while setting this up, copy the original back from Orchard.

Orchard CMS Quick Tip–Stop “Unable to launch the IIS Express Web server” SSL clashes

Posted on: Monday, 28 September 2015 11:27

When I’m working with Orchard I often want to have several copies of Visual Studio open, running several copies of Orchard for testing and comparison reasons. This is how I stopped the “Unable to launch the IIS Express" Web server” errors when I tried to launch two at the same time.

Orchard CMS Quick Tip–Orchard suddenly starts showing a 404 error for every page including the root

Posted on: Friday, 25 September 2015 11:18

As your working on your Orchard CMS website or maybe right after you have deployed it, you might suddenly find that nothing is working. If you’re getting a simple 404 page no matter what you try then this is the first thing you need to try.

SOLVED: Audio buzzing and crackling whenever the GPU is active or the mouse is moved

Posted on: Thursday, 24 September 2015 15:00

This problem seems to be somewhat common out there and mostly the solution is unique to your particular setup. Recently I was struck with a bad case of audio feedback from my computer whenever anything was happening on the screen. It was so bad I couldn’t even play computer games any more as the noise was too distracting. After trying a ton of different combinations I finally figured it out.

Orchard CMS Quick Tip–Always Start Without Debugging

Posted on: Wednesday, 16 September 2015 19:26

When you’re working on Orchard CMS in Visual Studio you will probably be tempted to press F5 as you normally do to start the solution in a web browser. Don’t do it!