I would like to edit the ASP.NET MVC templates for Visual Studio so that any new action or controller created has a specific piece of code within it by default.
For instance, I'd like to replace the generated:
public ActionResult MyAction()
{
return View();
}
with a specific coding standard we prefer to use within in my team. eg:
public ActionResult About()
{
try
{
DoStuff();
return View();
}
catch(Exception)
{
HandleException();
}
}
I've looked through the filesystem, but I cannot find anything specific that relates to the ASP.NET mvc templates. Anyone know where they are?
You may take a look at the following location:
C:\\Program Files\\Microsoft Visual Studio 9.0\\Common7\\IDE\\ItemTemplates\\CSharp\\Web\\MVC
Link for ASP.NET MVC 2 Project templates, not sure if same for ASP.NET MVC 1.0 though.
All inbuilt project templates are held in %VS-Root%\\Common7\\IDE\\ProjectTemplates
.
MVC project templates here (with my non-standard install folder) are C:\\VS2008\\Common7\\IDE\\ProjectTemplates\\CSharp\\Web\\1033\\MvcWebApplicationProjectTemplatev1.cs.zip
and C:\\VS2008\\Common7\\IDE\\ProjectTemplates\\VisualBasic\\Web\\1033\\MvcWebApplicationProjectTemplatev1.vb.zip
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.