.NET开发

本类阅读TOP10

·NHibernate快速指南(翻译)
·vs.net 2005中文版下载地址收藏
·【小技巧】一个判断session是否过期的小技巧
·VB/ASP 调用 SQL Server 的存储过程
·?dos下编译.net程序找不到csc.exe文件
·通过Web Services上传和下载文件
·学习笔记(补)《.NET框架程序设计(修订版)》--目录
·VB.NET实现DirectDraw9 (2) 动画
·VB.NET实现DirectDraw9 (1) 托管的DDraw
·建站框架规范书之——文件命名

分类导航
VC语言Delphi
VB语言ASP
PerlJava
Script数据库
其他语言游戏开发
文件格式网站制作
软件工程.NET开发
customize the template of new files in vs.net 2003

作者:未知 来源:月光软件站 加入时间:2005-2-28 月光软件站

In VS.net 2003, when we add a new item, i.e. a class, a webpage, or a form, to the project, the IDE will automatically generate some code in the newly-created files. This can surely save us some time writing repeated code. But sometimes we may want to customize the auto-generated code, for instance to add the copyright info in the header of the files. Although undocumented, there is a way to customize the templates from which vs.net 2003 created new files.
First let's take a look into the vs.net 2003 installation folder, as illustrated in the following figure:

VS.Net 2003 installation folder

We'll examine VC# folder only here, other folders (such as Vb7 and Vc7) are simlimar in structure. As can be seen, there is a “VC#Wizards” folder under “VC#”. This folder stores all the templates from which all the new files are created. Folder “VC#Wizards\1033” is the deposit for shared files common to all the templates, such as javascript, cascade style sheet, and images. “1033” stands for “US-English” culture. This number should vary according to your vs.net 2003 installation language. Except this shared folder, each folder under “VC#Wizards” represents one kind of template and has a “Templates\1033” subfolder in it. Again, “1033” have the same meaning with that under “VC#Wizards”.
For example, if we create a asp.net web application, the template for web form resides in “VC#Wizards\CShareWebAppWiz\Templates\1033”and is named "WebForm1.aspx", as shown in the following figure:

Template for Asp.Net Web application

Now we can customize the content of this file as we need. We can also make modification to other templates in the same way.

Please Note: The templates specified in this article have effect to all the users sharing the same computer and developing using vs.net 2003, so make sure your modification is what is really needed by everyone. Besides, vs.net 2003 is fully customizable, if you like, you can also choose to use vb macros to add some content to your code, which is especially useful for adding some universal comments (such as copyright info) whenever a new file is created.




相关文章

相关软件