How to add a File and Author details template at the top in a class by default

  • Thread starter Thread starter Vikash
  • Start date Start date
V

Vikash

Say Im going to create a new class called "master.cs"

if i created this file , by default file and author information should
be added at the top of the file.

Example

-------------------------------------------------------------------------

Author :

File Created: Today Date

File Modified: Today Date

Class Name : # Class Name Here # (Here master.cs)

Description :

--------------------------------------------------------------------------


This is my template , so this template should be added in my top of the
new class wid the same

format and we should customize the template also.

Vikash
 
Hi Vikash,

Are you asking how you can add a header to .cs files within a VS.NET
project? Personally, I would recommend against this unless you have an
automated solution since the overhead of maintaining the information costs
more than the value it provides and there are specialized management tools
available, external to Visual Studio, that you can use to manage projects
and source code, however you do have options:

1. If you are using Microsoft Visual SourceSafe there are special tokens you
can apply to your .cs files and VSS will automatically update the
information during check-ins:

Keyword expansion support information
http://msdn2.microsoft.com/zh-cn/library/d826hy97.aspx

List of supported keywords
http://msdn.microsoft.com/library/d...ry/en-us/guides/html/vstskexpand_keywords.asp

How to enable keyword expansion
http://msdn2.microsoft.com/zh-cn/library/yhb8w83x.aspx

2. In VS.NET 2005 you can create a code snippet and using a simple command
like "header"+Enter will write your snippet and supply tokens for
replacement such as Date and Class Name where you have specified.

http://msdn2.microsoft.com/en-us/library/ms165392.aspx

3. You could create a custom VS.NET macro or addin to provide the desired
functionality.

http://msdn2.microsoft.com/en-us/library/5abkeks7.aspx

- Dave Sexton
 
Back
Top