Bewerken

Delen via


Locate and organize project and item templates

When template files are placed in a known location, Visual Studio can locate the files and make them available for creating new projects and new items. Templates provide a convenient way to create applications, access class libraries, implement unit tests, and set up configuration files.

Installed templates and user templates (.vstemplate files) are stored in different locations. You can also customize the locations with Visual Studio options.

This article describes the template file locations recognized by Visual Studio.

Location for installed templates

By default, templates installed with Visual Studio are placed in the following locations:

  • %ProgramFiles(x86)%\Microsoft Visual Studio\2019\<edition>\Common7\IDE\ProjectTemplates\<Language>\<Locale ID>

  • %ProgramFiles(x86)%\Microsoft Visual Studio\2019\<edition>\Common7\IDE\ItemTemplates\<Language>\<Locale ID>

For example, the following directory has the Visual Basic item templates for English (LCID 1033):

C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\ItemTemplates\VisualBasic\1033

  • %ProgramFiles%\Microsoft Visual Studio\2022\<edition>\Common7\IDE\ProjectTemplates\<Language>\<Locale ID>

  • %ProgramFiles%\Microsoft Visual Studio\2022\<edition>\Common7\IDE\ItemTemplates\<Language>\<Locale ID>

For example, the following directory has the Visual Basic item templates for English (LCID 1033):

C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\ItemTemplates\VisualBasic\1033

Location for user templates

When you add a compressed (.zip) file that includes a .vstemplate file to the user template directory, Visual Studio makes the template available in the New project and New item dialogs. By default, user templates are placed in the following locations:

  • %USERPROFILE%\Documents\Visual Studio 2019\Templates\ProjectTemplates

  • %USERPROFILE%\Documents\Visual Studio 2019\Templates\ItemTemplates

For example, the following directory has user project templates for C#:

  • C:\Users\UserName\Documents\Visual Studio 2019\Templates\ProjectTemplates\Visual C#
  • %USERPROFILE%\Documents\Visual Studio 2022\Templates\ProjectTemplates

  • %USERPROFILE%\Documents\Visual Studio 2022\Templates\ItemTemplates

For example, the following directory has user project templates for C#:

  • C:\Users\UserName\Documents\Visual Studio 2022\Templates\ProjectTemplates\Visual C#

Change location for user templates

You can change the location for user templates in Visual Studio with the Tools > Options dialog. The location settings are on the Projects and Solutions > Locations page.