How to automatically add copyright information to your code

Source: Internet
Author: User
HowCodeAutomatically add copyright information

Most companies now require Program Add copyright information to the header of the program file so that the files written by everyone can be distinguished. If a file has a problem, you can quickly find the creator of the file, the problem can be solved in the shortest time, usually in the following format: // ========================================================== ====================================
//
// Copyright (c) 2007-2008 March software Studio
// All Rights Reserved
//
// Filename: class4
// Description:
//
// Created by Hou base at 03/09/2008 18:41:28
// Http://houleixx.cnblogs.com
//
// ========================================================== ====================================

Some people use the copy and paste methods, which is a waste of time and the effect is not very good. You can't go to paste in the above time, haha, next I will teach you how to add this information to make our code more personalized.
1. Under the installation path of Visual Studio 2005
For example:[Drive letter]: \ Program Files \ Microsoft Visual Studio 8 \ common7 \ ide \ itemtemplatescache
2. Find the folder:

It can be modified for various languages. If you modify the winform class, you can open \ CSHARP \ 2052 \ class.zip.Among them, \ CSHARP \ 2052 \ includes all templates of the winform file type.
Open class.zip and there is a class. CS file. We will modify it. When we add class files in winform, class files will automatically add our information.
As follows: // ========================================================== ====================================
//
// Copyright (c) 2007-2008 March software Studio
// All Rights Reserved
//
// Filename: $ safeitemrootname $
// Description:
//
// Created by Hou base at $ time $
// Http://houleixx.cnblogs.com
//
// ========================================================== ====================================
Using System;
Using System. Collections. Generic;
Using System. text;

Namespace $ Rootnamespace $
{
Class$ Safeitemrootname $
{
}
}

$ Rootnamespace $ is the name of the namespace of the generated class, $ safeitemrootname $ is the name of the generated class.
We can see that $ time $ is added to the copyright information, so that it can directly add the creation time to us. we can modify all templates in \ CSHARP \ 2052. do not modify the system code easily to avoid affecting our normal use.
For Web developers, you can modify the settings in itemtemplatescache \ WEB \ CSHARP \ 2052.
You can create a new class file to insert custom copyright information. // ========================================================== ====================================
//
// Copyright (c) 2007-2008 March software Studio
// All Rights Reserved
//
// Filename: newclass
// Description:
//
// Created by Hou base at 03/09/2008 20:31:56
// Http://houleixx.cnblogs.com
//
// ========================================================== ====================================
Using System;
Using System. Data;
Using System. configuration;
Using System. Web;
Using System. Web. Security;
Using System. Web. UI;
Using System. Web. UI. webcontrols;
Using System. Web. UI. webcontrols. webparts;
Using System. Web. UI. htmlcontrols;

/**/ /// <Summary>
///Summary of newclass
/// </Summary>
Public   Class Newclass
{
Public Newclass ()
{
//
//Todo: add the constructor logic here
//
}
}

Haha, isn't that cool! Please personalize your code!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.