No dots in Sitecore commands

Creating Sitecore commands is a powerful way to add additional functionality into a Sitecore solution. Commands are typically triggered by a Sitecore editor from the UI. It can be a ribbon button, a context menu or something else. The button/action fires a command name that is routed to a class inheriting the Command base class. This routing is typically defined in the commands section in the Sitecore config:

<configuration>
  <sitecore>
    <commands>
      <command name="nameofcommand" type="namespace.class, assembly" />
    </commands>
  </sitecore>
</configuration>

The command names are usually grouped, such as item:open, item:preview and so on. I like to include the project name I’m working on, or something in all my command names, so that I can easily distinguish my commands from Sitecore commands or commands provided by third party modules.

Today I found that command names cannot contain dots. If the command name contains a dot, it causes a JavaScript exception in the Sitecore UI and the command fails. So basically you can’t create a command like myproject:item.cleanup or myproject.item:cleanup. But a command names like myproject:item:cleanup will work just fine.