Thursday, 24 March 2005

Customising the default pages in Visual Studio.NET

When you add a new Web Form or HTML page to a project in VS.NET, it uses templates stored on your computer to generate the new page. You can customise these templates so that they contain extra code/layout info to save you having to enter everything in again each time you add a new file. eg. For VB.NET projects:
  • the template for ASP.NET WebForm pages is located by default in C:\Program Files\Microsoft Visual Studio .NET 2003\Vb7\VBWizards\WebForm\Templates\1033
  • and the one for plain HTML pages is in C:\Program Files\Microsoft Visual Studio .NET 2003\Vb7\VBWizards\HTMLPage\Templates\1033
So an example of a revised HtmlPage.htm file could be:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "">
<title>[!output SAFE_ITEM_NAME]</title>
<meta name=vs_defaultClientScript content="[!output DEFAULT_CLIENT_SCRIPT]">
 <meta name=vs_targetSchema content="[!output DEFAULT_TARGET_SCHEMA]">
 <meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
 <meta name=ProgId content=VisualStudio.HTML>
 <meta name=Originator content="Microsoft Visual Studio .NET 7.1">
 <meta name="Keywords" content="">
 <meta name="Description" content="">


No comments: