All docs
V20.2
20.2
20.1
The page you are viewing does not exist in version 20.1. This link will take you to the root page.
19.2
The page you are viewing does not exist in version 19.2. This link will take you to the root page.
19.1
The page you are viewing does not exist in version 19.1. This link will take you to the root page.
18.2
The page you are viewing does not exist in version 18.2. This link will take you to the root page.
18.1
The page you are viewing does not exist in version 18.1. This link will take you to the root page.
17.2
The page you are viewing does not exist in version 17.2. This link will take you to the root page.

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.

Export Code Templates

  • 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

    CodeRush menu is placed in Visual Studio Extensions menu for Visual Studio 2019. You can restore the default CodeRush menu position in Visual Studio 2019 16.4 or later. See the First Steps topic for more information.

  • Choose the template language from the "Language" drop-down list.

    Template Language

  • 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.

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

    Export Folder

  • 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

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

  • Choose the template language from the "Language" drop-down list.

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

    Import Templates

  • 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.

  • 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

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