Thursday, January 17, 2008

QuickTemplates

I was recently asked how to install QuickTemplates.

This is a perfectly reasonable request, however until now there has not been an online assembly.

So now I present QuickTemplates.DLL (Zipped).

This has been compiled against DXCore 3. (since I don't work with anything less than the latest bleeding edge stuff :))

So just drop it in "C:\Program Files\Developer Express Inc\DXCore for Visual Studio .NET\2.0\Bin\Plugins" ( by default) and Away you go.

You'll need to bind a key to the "Create Quick Template" action on the Shortcuts page in Options.

-------------------------------------------------------------
Follow these steps to get to the Shortcuts options page:

1. From the DevExpress menu, select "Options...".
2. In the tree view on the left, navigate to this folder:

    IDE

3. Select the "Shortcuts" options page.
-------------------------------------------------------------

This is still rough and ready, but it does the job.

Feel free to post comments or email if you need more help :)


Wednesday, January 02, 2008

A Simple Lazy-Load CodeRush Template

I can't tell you how often I've written this code manually.image

Or alternatively...

image

So I have finally created a couple of CodeRush Templates to facilitate this.

LLS (Lazy load Static) - Triggers the first expansion.
LLM (Lazy Load Module) - Triggers the 2nd expansion.
LL - Is aliased to LLS.

Templates are lower case in reality, but lowercase 'l' is easily confused with upper case 'I' in some fonts.

Feel free to download them from here and import them for your own use.


How to Rebuild your CodeRush Templates

Warning: Please be sure that you have Exported any Custom Templates that you care about before you attempt this.

The templates that you use day to day are stored in your user profile. If you need to rebuild them for some reason, then CodeRush will do so from it's own internal store which does not contain any customizations that you may have made.

Delete your existing Templates.

Deleting your existing Templates is a simple matter of finding the appropriate file and deleting it. These are organised by language under your profile directory.

Mine is located at "C:\Users\Rory.Becker.MyDomain\AppData\Roaming\CodeRush for VS .NET\1.1\Settings\Editor\Templates"

In this folder I have a number of files. I am only interested in rebuilding my Visual Basic ones but you should be able to find suitable files for each language you have been using.

If you are also working with VB.Net, then you should at this point delete (or Move if you're paranoid) 'templates.Basic.bin' and 'templates.Basic.xml'.

Rebuild your Templates.

Next you'll need to perform the actual rebuild.

-------------------------------------------------------------Follow these steps to get to the Templates options page:

1. From the DevExpress menu, select "Options...".
2. In the tree view on the left, navigate to this folder:

    Editor

3. Select the "Templates" options page.
-------------------------------------------------------------

Now if you make sure of viewing the templates for the language that you wanted to rebuild, you will find that all the standard templates are back.

Next you'll want to Import your Custom Templates


How to Import CodeRush Templates

-------------------------------------------------------------Follow these steps to get to the Templates options page:

1. From the DevExpress menu, select "Options...".
2. In the tree view on the left, navigate to this folder:

    Editor

3. Select the "Templates" options page.
-------------------------------------------------------------

Now...

  1. Select the folder containing the templates that you wish to export.
  2. Right Click the Folder
  3. Select Import Templatesimage 
  4. Locate an XML file containing previously exported Templates.
  5. Click Ok and you're done.

How to Export CodeRush Templates

So why would you want to export templates anyway?

Well Imagine that you've just downloaded the latest CodeRush build. version 3.0.5 at the time of writing.

Clearly you want to be able to take advantage of all the new templates that the geniuses (is that a word - Seems like it should be Genii) at DevExpress may have added.

But CodeRush is polite and understands that you may have added your own customizations to the existing template set and so the behaviour for CodeRush is to not alter your existing Templates (Stored in your Profile) but to do nothing ... just in case.

But you still want your new templates right? So how do you do it?

Well first you organise your own templates in a folder called (by convention) "custom". Then you export that folder of Templates and then ask CodeRush to rebuild you templates from scratch and finally Import your own templates back into CodeRush.

Simple right?

Well yes, but just in case, I have provided steps for each.

Exporting you custom Templates.

-------------------------------------------------------------Follow these steps to get to the Templates options page:

1. From the DevExpress menu, select "Options...".
2. In the tree view on the left, navigate to this folder:

    Editor

3. Select the "Templates" options page.
-------------------------------------------------------------

Now...

  1. Select the folder containing the templates that you wish to export.
  2. Right Click the Folder
  3. Select Export Folder image
  4. Select a location on disk to export to.
  5. Click Ok and you're done.