Using File Templates

File Templates let you add new files to your project with predefined code fragments already generated in them. The code of a File Template can consist of any structure, particularly, any code that may belong in a separate file: a class declaration, an interface or struct declaration, and so on.

File Templates are very similar to Live Templates. The main difference is that they are meant to contain code to be stored in a separate file.

Using File Templates

Follow these steps to invoke a File Template:

  1. Do either of the following:
    • Open the ReSharper menu;
    • In Solution Explorer, right-click a project or folder;
  2. Click New from Template and do either of the following:
    • Click a template in the list of templates (the Quick access list) to invoke it.
    • Click More to see all available File Templates to choose from. The following dialog will be displayed:

      Navigate to the template you want, select it, and click OK.

      Tip   In this dialog, you can add a File Template to the Quick access list to have quicker access to it the next time you need it. Select the template and select the Add to quicklist checkbox, then click OK. For details on managing the Quick access list, and File Templates in general, see Managing and Sharing File Templates.
  3. After you invoke a template, the following dialog appears:

    Enter a name for the new file and click OK. The new file is added to your project and is opened in the editor. The file contains the code specified in the template (see Predefined File Templates for the description of each template that comes with ReSharper).

Note   File Templates use the indentation set by your code style settings (for help on style settings, refer to Code Style/Code Formatting).

Creating Your Own File Templates and More

You can:

For details please refer to Managing and Sharing File Templates.

See Also

Predefined File Templates | Managing and Sharing File Templates