Some time ago, I published an article titled "How to automatically add copyright information to my code", which was strongly supported by my friends in the garden, I hope I can explain more detailed parameters. Below I will summarize these parameters and add copyright information.
Parameters |
Description |
Clrversion |
Current SystemCLRVersion Number |
Guid [1-10] |
Generate a globally unique identifier , can generate 10 ( for example : guid1) |
itemname |
open the file name entered when the new item is added |
machinename |
name of the current machine ( for example, : pC1) |
registeredorganization |
name of the registered organization |
rootnamespace |
namespace name |
safeitemname |
saved file name |
time |
current system time , Format : dd/mm/yyyy 00:00:00. |
userdomain |
User's domain |
username |
current system user name |
Year |
Current System TimeYyyy. |
Some parameters are provided above. (I hope someone will continue to add it ), I have tested it in vs2005. The demonstration result is as follows:
Parameter information: 1 // ========================================================== ====================================
2 //
3 // Copyright (c) 2007-2008 March software Studio
4 // All Rights Reserved
5 // Guid1: $ guid1 $
6 // Guid2: $ guid2 $
7 // Guid3: $ guid3 $
8 // Guid4: $ guid4 $
9 // Guid5: $ guid5 $
10 // CLR version: $ clrversion $
11 // Name entered for the new item: $ itemname $
12 // Machine name: $ machinename $
13 // Registered Organization Name: $ registeredorganization $
14 // Namespace name: $ rootnamespace $
15 // File Name: $ safeitemname $
16 // Current System Time: $ time $
17 // User's domain: $ userdomain $
18 // Current logon Username: $ username $
19 // Creation year: $ year $
20 //
21 // Created by Hou base at $ time $
22 // Http://houleixx.cnblogs.com
23 //
24 // ========================================================== ====================================
25
Effect after adding: (For details, refer to "How to automatically add copyright information to your code ") // ========================================================== ====================================
//
// Copyright (c) 2007-2008 March software Studio
// All Rights Reserved
// Guid1: 0a3c2c25-ce8f-4e8d-9a02-291bacb5d278
// Guid2: b50a2fd2-7a9c-4af0-8a8a-26e2f2c5c770
// Guid3: 4186fb52-22ef-4be7-bec4-388b1e479624
// Guid4: 8f76ffc6-206b-480e-a5b1-c95e02f0d630
// Guid5: 5266c864-2d1e-400a-bf98-5fc687e6c889
// CLR version: 2.0.50727.42
// Name of the new item: Test
// Machine name: Pc5
// Registered Organization Name: houlei
// Namespace name: leleapplication1
// File Name: Test
// Current System Time: 11:06:58
// User's domain: houlei
// Current logon Username: Administrator
// Creation year: 2008
//
// Created by Hou base at 03/29/2008 11:06:58
// Http://houleixx.cnblogs.com
//
// ========================================================== ====================================
You can customize the information as needed.
I will summarize the modifications to the template:
1. last time I mentioned modifying the template in itemtemplatescache, it only modifies the cache template and executes devenv/setup to reconfigure vs. These templates will automatically change back to the original template. our template information will be lost.
2. for this kind of template loss, we can directly modify the templates in itemtemplates. Some compressed templates in itemtemplates are read-only and can be modified. cache templates are extracted from itemtemplates each time devenv/setup is re-configured. in this way, Vs will not be lost when it is reconfigured.
3. one drawback of the above method is that we have cracked the template information of the system, which may be used at some time. there is a better way to solve the above problem.
That is to say, is there a way to choose between the system template and the custom template when we add a new project.
Copy the compressed files under common7 \ ide \ itemtemplates \ CSHARP \ 2052 to C: \ Documents ents and Settings \ USERNAME \ My Documents ents \ Visual Studio 2005 \ Templates \ itemtemplates \Visual C # (or Web Version)And then modify it. When we add new items, those templates will appear in"My templates"Below. If you writeCode, You only need to put these templates in your own folder, which is also very convenient to carry. (This method is provided by Vincent Yang)
From my previous articleArticleIn the comments, we can see that there are still good methods. Here we will not give them one by one. you can search for it in the comment on how to automatically add copyright information to your code. find your preferred adding method.
Reflection on copyright information:
We can not only use this method to add copyright information, but also add unified project specifications, such as namespaces, which can save a lot of code and time.
The above is transferred from http://www.cnblogs.com/houleixx/archive/2008/03/29/1128600.html
As you can see, there are a lot of things that can be developed with just a little copyright. There are still a lot of things. Come on slowly :)