Change the default page class in visual studio
When creating a new web form the default page class is System.Web.UI.Page. Can thi开发者_开发问答s default be changed in visual studio 2010 so that it uses a custom class that we created that inherits from System.Web.UI.Page?
Cheers!
This requires editing a file within a zip.
Open:
C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\ItemTemplatesCache\CSharp\Web\1033\WebForm.zip
Extract and edit
default.aspx.cs
. Modify as you like!Save that file back into the .zip.
Repeat the same in C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\ItemTemplates\Cache\CSharp\Web\1033\WebForm.zip
Any new webform items you add to projects will contain the modifications you made.
Ensure the changes are in both ItemTemplates
and ItemTemplatesCache
.
精彩评论