(This is an original tutorial. For more information, see the source)
Step 1: Open Visual Studio (although Visual Studio 2008 is used here, Visual Studio 2005 is also applicable and the creation method is the same)
(Figure 1)
Step 2: Create a new project and name it mytemplate (it is better to write it as myprojecttemplate, so that you can easily distinguish between project template and item template). In this example, all I use is the console project, if you want to first ASP. to create an ASP. NET template. net website.
(Figure 2)
Step 3: After you have created the console applicationProgramIn the future, we will put the copyright information you want to add and # region into the correct position. As for the $ XXXX $ keywords in the copyright information, I will not complain here. Go to the msdn to see how it works. Http://msdn2.microsoft.com/en-us/library/eehb4faa (vs.80). aspx
(Figure 3)
Step 4: The previous work is about how to create a template. After all the preparations are completed, the next steps are as follows:ExportThe template is critical.
First, select "Export template" from the File menu ("Export template" in Chinese, if the Chinese language is not degraded)
(Figure 4)
Step 5: After you select the export template, the window Figure 5 will pop out. Here we mainly select the template type you want to create. Microsoft divides the template type into two types:
1. Project template (Project template ?? If the translation is incorrect, let's take a look at the picture)
2. Item template (sorry, I don't know what Chinese is)
From Step 5 to Step 8, we create a project template, followed by repeating the previous work and creating an item template.
In this step, I want to explain that some of my friends may confuse these two templates, in fact, the simplest understanding is that the project template is a custom template that is displayed when you open Visual Studio to create a project. if you want to create a console application, you will naturally select new project, and the console application will be displayed in it, so our project template is equivalent to this. figure 8 includes our custom templates and templates provided by Visual Studio.
So what is the item template? Actually, after you create a project, you will add the class, interface... and so on, then you will inevitably use add new item, and our custom item template will be displayed in this. figure 12 includes our custom item template and the item template that comes with Visual Studio.
(Figure 5)
Step 6: After you select the template type, this step is to name your template. By default, the Template Name is your current project name, here you can use the company name to differentiate. For example, if I want to write a program to the CNC machine, I will use a CNC machine. XXX, when I change my job or temporarily go to another company to do work, I just need to create one and use it in this company. In this way, even if you go back to the CNC job in the future, you don't have to wear a new template for the CNC.
When the name is ready, you can change your template to your own icon and add some template descriptions. After you fill in all the information, the following shows you where your template will be output, whether to automatically import the template to Visual Studio, and whether to open the template Output Folder.
(Figure 6)
Step 7: If you have selected the bottom option in the last step, Visual Studio will open the export file home of this template. You can back up the file by hand.
(Figure 7)
Step 8: As described in the previous seven steps, we have created our own template. Now we will enjoy the joy that the template brings to you.
(Figure 8)
The following content is the same as the previous one. It is only used to create an item template. I will not repeat it here.
All right, I have finished talking about it. If you have any questions or suggestions, you can leave a message on my blog. If you are not clear about it, please forgive me, when I write a blog, I find that my Chinese language is regressing.
(Figure 9)
(Figure 9)
(Figure 10)
(Figure 11)
(Figure 12)