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.
To open this page, choose the CodeRush | Code Templates… menu item in Visual Studio.
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.
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.
In the “Save As” dialog, type the name of your export file, specify the file location, and click Save.
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.
In the Open dialog, choose the xml file that contains templates you want to import, and click Open.
If the template category you want to import already exists in the templates tree, CodeRush shows the following 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.
Click Apply and OK in the Templates options page to save the templates and close the page.