In daily development, we often need to add comments, copyrights, and other information to the page, so that we need to copy and paste the same text each time. In order to reduce this repetitive work, we can save this information in the Visual Studio 2012 class library template file.
1. Right-click your vs icon and choose Properties> open the directory where the file is located, and find the following list: csarp folder
Quickly find the vs installation directory.
Vs2010: % ProgramFiles % \ Microsoft Visual Studio 11.0 \ common7 \ ide \ itemtemplatescache \ CSHARP
Vs2010: % ProgramFiles % \ Microsoft Visual Studio 10.0 \ common7 \ ide \ itemtemplatescache \ CSHARP
Vs2008: % ProgramFiles % \ Microsoft Visual Studio 9.0 \ common7 \ ide \ itemtemplatescache \ CSHARP
Vs2005: % ProgramFiles % \ Microsoft Visual Studio 8 \ common7 \ ide \ itemtemplatescache \ CSHARP
Copy to the address bar and press enter, which is convenient and quick. (I have tested vs2012 and can use it ,)
2. Find the code module commonly used for your development and modify the file.
Let's take the template *** \ Microsoft Visual Studio 11.0 \ common7 \ ide \ itemtemplatescache \ CSHARP \ WEB \ 2052 \ webform as an example:
Modify default. aspx default Template
Add the code at the top of the front-end template page:
<% ---------------------------
'Created:
'Creation time: $ time $
'Function:
'Modifier:
'Modification time: $ time $
'Modification content:
'--------------------------- %>
Modify default. aspx. CS default Template
Background code
//-----------------------------------------------------------------------------
// Created:
// Creation Time: $ time $
// Function:
// Modifier:
// Modification time: $ time $
// Modify the content:
//-----------------------------------------------------------------------------
Modify the style according to your preferences.
The template can be customized by referring to the following system parameters
The characters between the "$" symbols in the Code are template variables. For more information about the variables, see:
$ Time $ date
$ Year
$ Clrversion $ CLR version
$ Guid $ The GUID used to replace the project guid in the project file. You can specify up to 10 unique guid1 guids )).
$ Itemname $ name provided by the user in the dialog box.
$ Machinename $ name of the current computer (for example, computer01 ).
$ Projectname $ name provided by the user in the dialog box.
$ Rootnamespace $ root namespace of the current project. This parameter is used to replace the namespace in the items added to the forward project.
$ Safeitemname $ name provided by the user in the "Add new item" dialog box, excluding all unsafe characters and spaces.
$ Safeprojectname $ name provided by the user in the "New Project" dialog box, excluding all unsafe characters and spaces.
$ Time $ the current time in the format of DD/MM/YYYY 00:00:00.
$ Userdomain $ current user domain.
$ Username $ current user name.
And so on...
My changes are as follows:
Front-end:
Background:
You can find and modify other templates as follows:
Visual Studio creates a code annotation default Template Method