Customising the default pages in Visual Studio.NET

Written on March 24, 2005

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" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<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="">
</head>
<body MS\_POSITIONING="\[!output DEFAULT\_HTML\_LAYOUT\]">

</body>
</html>

Categories: