Skip to main content
All docs
V22.2

Export and Import Templates

  • 2 minutes to read

You can export your custom code templates to an xml file and share this file with other developers. CodeRush also allows you to import code templates created by other developers.

Important

Visual Studio IntelliSense has priority over CodeRush templates. For information on how to prioritize a CodeRush template over Visual Studio IntelliSense, refer to the following topic section: Expand a Template Instead of Visual Studio IntelliSense.

Export Code Templates

  1. Open the Templates options page.

    Template category

    To open this page, choose the CodeRush | Code Templates… menu item in Visual Studio.

    Templ_Config_path

    Note

    In Visual Studio 2019, CodeRush menu is placed into a new location - in Visual Studio Extensions menu. You can reposition the CodeRush menu back to the top level of the Visual Studio menu bar in Visual Studio 2019 version 16.4 or later. See the following topic for more information: First Steps.

  2. Choose the template language from the “Language” drop-down list.

    Template Language

  3. Position templates you want to export in a folder.

    For example, you can arrange your custom templates in a custom folder to separate them from other templates. See the following example for information on how to create a category for your templates: How to: Create a Template from Scratch.

  4. Right-click the folder you want to export and choose the Export Folder… menu item.

    Export Folder

  5. In the “Save As” dialog, type the name of your export file, specify the file location, and click Save.

    Save As

    CodeRush suggests the file name based on the language of the template set and the folder that contains templates you want to export (for example, CSharp_Custom).

Import Code Templates

  1. Open the Templates options page as described in the previous section.

  2. Choose the template language from the “Language” drop-down list.

  3. Right-click any folder in the templates tree and choose the Import Templates… menu item.

    Import Templates

  4. In the Open dialog, choose the xml file that contains templates you want to import, and click Open.

    Open File With Templates

    If the template category you want to import already exists in the templates tree, CodeRush shows the following dialog:

    Category Exists Dialog

    You can either replace templates in this folder or rename the import folder.

  5. Choose the appropriate action in the Category Exists menu and click OK.

    CodeRush adds the import category to the end of the templates tree.

    Category Exists Dialog

  6. Click Apply and OK in the Templates options page to save the templates and close the page.