Managing and Sharing File Templates

You can manage File Templates in the following ways:

File Templates Dialog

Management of File Templates is performed via the Options - File Templates dialog. To open it, select ReSharper | Options from the main menu and in the left pane click File Templates .

Available Templates

The structured view presents all available File Templates with their abbreviations and brief descriptions. Available templates and folders containing them are organized in four sections explained below:

Quick Access List

You can put your favorite templates on the Quick access list. Templates in this list will be available for quick use. For details on working with Quick Access List, see Organizing File Templates.

Preview

When a template is selected in Available Templates, its definition (template code) appears in this text field. To modify the code of a template, double-click the template in Available Templates or use the toolbar (see below).

Toolbar

The toolbar is located above Available Templates . It lets you create, edit, move, delete, export and import templates and share them with members of your development team. The following table explains the purpose of each button:

 

Button

Name

Description

Create Template

Creates a new template. See Organizing File Templates.

Create Folder

Creates a new template folder. See Organizing File Templates.

Copy Template or Folder

Creates a copy of the currently selected template or folder in the specified location. See Organizing File Templates.

Delete

Deletes the selected template or folder (confirmation is requested). See Organizing File Templates.

Edit Template

Opens the Edit Template dialog for editing the selected template. Please refer to Editing Templates  for details.

Move Template or Folder

Moves the selected template or folder. See Organizing File Templates.

Import Templates from File

Imports template(s) from an XML file containing File Templates. See Importing and Exporting File Templates.

Export Templates from File

Exports template(s) to an XML file. See Importing and Exporting File Templates.

Mount File Storage Mounts file storage from a file that contains File Templates designed for common use among a group of developers. See Sharing File Templates .


Organizing File Templates

 

To create a new template:

  1. Click  (Create Template). The Choose Destination Folder dialog is displayed:

  2. Do one of the following:
    • Select an existing folder for the new template and click OK.
    • Create a new folder for the new template: click  and specify the new folder name. Then select the folder and click OK.
  3. Specify the new template's details via the Edit Template dialog. Please refer to Editing Code Templates for details.

To create a new template folder:

  1. Click  (Create Folder). The Choose Destination Folder dialog is displayed.
  2. Choose the new folder's location using the dialog and click OK.

To create a copy of a template or folder:

  1. Select a template or folder.
  2. Click  (Copy Template or Folder). The Choose Destination Folder dialog is displayed.
  3. Select the destination folder for the new template or folder and click OK.

OR

Note   Templates with identical names will conflict with each other. If you've copied a template, modify its name and/or template code to avoid ambiguity and possible errors.

To delete a template or folder:

  1. Select the template or folder and click  (Delete).
  2. Confirm deletion.
Note Predefined templates and the four main folders cannot be deleted.

 

To edit a File Template:

  1. Select the template.
  2. Click  (Edit Template) or double-click the template.
  3. Modify template details via the Edit Template dialog. Please refer to Editing Code Templates for details.
Tip   It is recommended that you don't modify predefined templates, since any changes may be lost if you later re-install ReSharper. Instead, make a copy of the template and edit it.

To move a template or folder:

  1. Select a template or folder.
  2. Click  (Move Template or Folder). The Choose Destination Folder dialog is displayed.
  3. Select the destination folder for the new template or folder and click OK.

OR

  1. Drag the template or folder to the destination folder.
Note    Predefined templates and the four main folders cannot be moved (but predefined templates can be copied).

To edit the Quick access list:

You can add templates to the Quick access list, remove templates from the list and rearrange their order within the list. Use the buttons described below:

 

Button

Description

Adds a template to the list.

  • Select a template in Available templates and click .

Moves the selected template one position higher in the list.

  • Select a template in Quick access list and click .

Moves the selected template one position lower in the list.

  • Select a template in Quick access list and click .

Deletes the selected template from the list.

  • Select a template in Quick access list and click .


Importing and Exporting File Templates

File Templates can be exported to an XML file. This allows you to save your customized templates so that you can distribute them, share with other developers, temporarily save them between re-installations of ReSharper, and so on. Once exported (by you or someone else), File Templates can be imported.

To export templates:

  1. Click  (Export Templates to File). The following dialog is displayed:

  2. Select the checkboxes of the templates you would like to export. Optionally, select a folder to include all of the templates it contains.
  3. Specify the file to export to, using the browse button if necessary. Click OK.

To import templates:

  1. Select the destination folder for importing templates, other than Predefined Templates.
  2. Click  (Import Templates from File). The Choose File with Templates dialog is displayed.
  3. Specify the file from which to import templates. The templates file must have been created with ReSharper for the import to work correctly.
  4. Click OK.

Sharing File Templates

File Templates can be shared in two ways.

Shared Solution Templates folder

You and other members of your development team can use this folder to store shared templates designed for use with any particular solution. Templates placed in the folder will be accessible to anyone who opens the current solution. Compare with Personal Solution Templates folder: templates it contains are available for your personal use with a particular solution, but not to others.

Mounted File Storage

File Templates can be shared among a group of developers via Mounted File Storage. First, all members of a development team mount file storage. The file contains templates designed for common use by a group of developers. It is stored on a shared network location accessible to each developer. Templates contained in the mounted file are updated from and to the file with every opening and closing of the solution. Any changes made to the file are automatically made available to all other developers.

To mount file storage:

  1. Click  (Mount File Storage). The Choose File with Templates dialog is displayed.
  2. Specify the file from which to import templates. The templates file must have been created with ReSharper for the import to work correctly.
  3. Click OK.

See Also

Using File Templates | Predefined File Templates | Editing Code Templates