Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I edit default Razor Creat/Edit scaffolding in Visual Studio 2010

is there a way I can hack out the fieldset and legend tags in the VS2010 MVC razor view templates?

I've had a bit of a look through the C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE directory but I can't find what I'm looking for.

like image 543
Rob Avatar asked Feb 23 '23 10:02

Rob


1 Answers

If it is specific to your project, what you can do is copy the default templates to  your project and modify them.

The MVC razor view templates are located in:

<Visual Studio Installation Path>\Common7\IDE\ItemTemplates\CSharp\Web\MVC 3\CodeTemplates
\AddView\CSHTML\
  1. Copy the .tt files

  2. Create a matching folder tree in your project starting from CodeTemplates. In this case,  you need to create \CodeTemplates\AddView\CSHTML\ and paste the .tt files there.

  3. Now you can edit the .tt files as you want. When you crete a new view in that project, those templates will  be used instead of the default ones from the installation folder. That also works for the controller templates, you just have to make sure that the folder  tree matches.
like image 152
bubbassauro Avatar answered Feb 25 '23 22:02

bubbassauro