Exporting and Importing CodeRush Templates

CodeRush’s Templates are awesome.

Sadly we can’t ship every conceivable variation of awesome out of the box. However we do ship the ability for you to write your own templates.

I’ve blogged about creating templates before, but thought it might be worth reminding you how to Export your templates for sharing and how to Import templates written by others.

Exporting Templates

From the templates options screen (Ctrl+Shift+Alt+O, Editor\Templates) you should arrange your templates such that:TemplatesExportFolder

  1. Custom templates are positioned in a custom folder within the Hierarchy
    Note: This isn’t required as such, but it can make a great deal of sense to have all your custom templates beneath a single location.
  2. Position the templates you’d like to export in a folder on their own.
    We’re not trying to make the templates feel bad, it’s just that the unit of export for templates is folder based.
    For example: I have a bunch of plugin templates positioned in a Custom\Plugins folder.

To perform the actual export…

  1. Right click the folder you’d like to export and choose Export Folder…
  2. Name your export file. (The default name provided is based on the language of the template set, and the folder being exported.)

At this point you have a totally portable .xml file which can be taken to another computer and imported.

TemplatesImportTemplatesImporting Templates

From the templates options screen (Ctrl+Shift+Alt+O, Editor\Templates)

  1. Ensure you have the correct language selected.
    OptionsLanguage
  2. Right anywhere in the template tree
  3. Choose Import Templates…
  4. Locate and choose the file containing the templates you’d like to import

If the template file indicates a folder that you already have then you will be offered the following dialog:

CustomizeTemplateImportFolder

The default choice here will wipe any duplicate templates found in your existing system in favour of those found in the templates file.

In the example above, I am importing some templates into a ‘Custom’ folder so those are the only ones at risk.

If you are unsure, feel free to pick the 2nd option and change the top level folder to something new (perhaps ‘Custom2’). You can then examine the plugins imported into that folder and decide which ones you’d like to keep. You can either move them around manually or decide that they’re all fine and reimport over the top of the original location (remembering to delete the ‘Custom2’ folder if this is the case)

Summary

So you now have the tools to let you export some of your own awesome templates for others to use.

Why not spread the wealth and share your templates with co-workers or even with the wider community.

In some upcoming posts I’ll be doing exactly that. Sharing some of my own custom templates with you to help make your coding lives easier.

Update: Another way to import CodeRush templates, is to pull them straight off the web using the Template Importer

no comments
No Comments

Please login or register to post comments.