Jonesopolis
Jonesopolis

Reputation: 25370

ASP.NET MVC 5 Alter View Templates

I'm working on the CSS/Design side of an ASP.NET MVC 5 project with a few other guys. I've made the first CRUD Controller, and the views, and I'd very much like to enforce the general design I have laid out for it for any other views, so they can't go around screwing it up (without really looking like they tried to).

Is it possible to alter the views that are autogenerated when you create a controller, or when you click "Add View" from an action, just for this specific project? I've done some searching, and located the templates, but overriding them in my project doesn't appear to be working. It looks like it may be a bit different for MVC 5 than the others.

Any help is greatly appreciated!

Upvotes: 2

Views: 1179

Answers (1)

Jonesopolis
Jonesopolis

Reputation: 25370

Well I was right that it's a bit different in MVC5. This fantastic guy's page tells us the new templates are at

C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\Extensions\Microsoft\Web\Mvc\Scaffolding\Templates

and to just add them to a folder in your project called "CodeTemplates" and voila!

Upvotes: 1

Related Questions