次の方法で共有


Reorganize the Default Item Templates

Versions:  2008,2010
Published:  11/10/2010
Code:  vstipProj0021

 

WARNING:  Everything I'm about to show you could cause your templates to disappear if you don't FOLLOW THE INSTRUCTIONS CAREFULLY.  So do this at your own risk. 

 

In vstipProj0018 (https://blogs.msdn.com/b/zainnab/archive/2010/11/07/reorganize-the-default-project-templates-vstipproj0018.aspx) I showed you how to reorganize your project templates so it's only natural that we now tackle how to do the same thing with item templates. 

 

Ever notice that in the General section for new items there is just a lot of stuff in there?  Ever want to organize it a bit more?  I'm going to show you how you can create custom areas for your default item templates that come with Visual Studio.  In this example, we will create a Diagram area for our diagram items that are currently in the General section:

image

 

 

Navigate to C:\Program Files\Microsoft Visual Studio <version>\Common7\IDE\ItemTemplates\<language>.  You will probably have to dig deeper depending on what you are after and the path may be slightly different based on Visual Studio version.  In this case the actual full path on my machine is "C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\ItemTemplates\CSharp":

image

 

 

Now create a new folder called "Diagrams":

image

 

 

Go into the General\1033 folder and locate the diagram .ZIP files you want:

image

 

 

And CAREFULLY move them to the Diagrams folder:

image

 

 

Close all instances of Visual Studio and then run the following command from the Visual Studio Command Prompt: "devenv.exe /installvstemplates"

image_thumb72

 

 

While it is running it is VERY important that you let it finish.  It will run devenv.exe without any interface so you should bring up the Task Manager (CTRL + ALT + DELETE) and watch the process until it disappears from the process list:

image_thumb42

 

 

When it is done, open up Visual Studio, then any project, and go to the Add New Item dialog (CTRL + SHIFT + A).  Notice your brand new Diagrams area with your templates inside it:

image

 

 

That's all there is to it.  Now you can have you're default templates organized the way you want.