customize the template of new files in vs.net 2003
2004-11-18 09:28
651 查看
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:
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:
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.
First let's take a look into the vs.net 2003 installation folder, as illustrated in the following figure:
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:
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.
相关文章推荐
- The usage of intellisense in Vs .net 2005
- New Feature In the VS.Net 2005 Editor
- A VS.NET add-in to know the content of the any dataset during debugging
- An Overview Of The New Services, Controls, And Features In ASP.NET 2.0
- Intanced Tessellation -- A new part of the GPU pipeline for surface techniques in DX10 and coming DX11
- How do I make my GUI plot into an axes within the GUI figure rather than inside of a new figure in M
- What's New in the .NET Framework Version 2.0
- What's New in the .NET Framework 2.0 Beta
- 获取本机已安装的软件列表C#/VB.NET(Get the list of installed software in local pc)
- Deprecated: Assigning the return value of new by reference is deprecated in……【解决方法】
- Open Source Development (This Article Is the Winner of PRSA 2003 Award in Excellence in Technology …
- Code snippet of the day : Resizing ASP.NET Datagrid Controls in Edit mode at runtime
- flex/in the datagrid,how to get the new value of cell in the datagrid after edit
- The Big List of What’s New or Improved in Silverlight 5
- Accessing DWG files not open in the AutoCAD editor using .NET
- PHP显示Deprecated: Assigning the return value of new by reference is deprecated in解决办法
- [转]Sorting, Filtering, and Paging with the Entity Framework in an ASP.NET MVC Application (3 of 10)
- A new version of the ASP.NET Ajax Library has been released
- 复制单链表成为新的链表,然后return the number of items in the new list
- \t\tINFO: Performance of XSLT Transformations in the .NET Framework