VS2010 add custom creator, creation time and other personal information of the new template file

VS2010 has unwittingly become an indispensable tool for .NET developers, compared to the classic version of VS2005, the transition to version VS2008 , 2010 in terms of performance stability and ease of use have been greatly improved.

VS combination tool, under which plug-ins are endless. Today, the focus of how to use VS2010 to introduce new custom template files, the new files, add personal information, such as: creator, creation time and other personalized information.

For developers, this machine has provisions for the new version of the file will automatically add, add people, add time and other information.

To do the following:

1. Open the VS2010 install directory, such as: the I: \ Program Files \ in the Microsoft Visual Studio 10.0 \ Common7 \ IDE \ ItemTemplates

in this directory, you will see a list of all types to create the directory, and you want to open file settings, such as: Windows Forms in CSharp directory \ Form.zip 2052 under

this compression is a new template package file exists, if you modify this Form.cs, then when you create a new file Form, will you appear defined templates. Below we look at how to modify the template

to open this compressed file form.cs file, you will see the hot words of the $ if only, these will be dynamically resolved in the new document, the result is returned to the newly created file. In the New Form when we want to add

personal information, you can add the following

#region Version Info
/ * ============================== ==========================================
* [This Functional Overview]
*
* Author: ywg time: $ Time $
* File Name: $ safeitemname $
* Version: V1.0.1
*
* modified by: Time:
* Change Note:
* ======== ================================================== ==============
* /
#endregion

including fixed-coded content, the template is fixed on the presentation,

$ time $ displays the current time

$ safeitemname $ created to display the current file name

$ safeprojectname $ displays the current project name

$ year $ displays the current year

when $ projectname $ when creating a new project, specify the project name

$ clrversion $ CLR to resolve the current version value

$ GUID [1-10] $ define the scope of the current GUID

these values are according to you to create different files, dynamic, and can be dynamically set and added as needed. The new file, I feel as templates available for viewing, of course, more detailed features

still need to be added manually modified human template.

After modification, save, zip automatically stored, other new file can be modified, as appropriate, may need to modify the actual file.

2, when you finish editing the content to be set, then need to close the open window of VS2010, began to re-register to modify the template.

Registration method is very simple, in the beginning - "Programs, select Visual Studio propositions have prompt tool under Visual Studio Tools under VS2010, click to open the

run devenv / setup This process may take about 1 minute

after the registration is complete, re-open VS2010 new file, you will be in the new file, you will see the new custom content.

NOTE: After this modification, the original template will be lost, if you want to restore the original template VS2010 state, it is necessary to back up in advance corresponding to VS2010 template, and then registered in accordance with the above method.

For people with fixed machine writing code, after setting the template more convenient.

Reproduced in: https: //www.cnblogs.com/Alenliu/p/5069578.html

Guess you like

Origin blog.csdn.net/weixin_34356310/article/details/93470076