Reputation: 35973
I am developing an ASP.NET MVC 5 project. (not ASP.NET 5). Recently I switched to VS 2015. Now I decided I would like to create customized scaffolded Views and Controllers for my EF entities. So I searched and found Scott Hanselman's article about this topic. (It is obviously old). I've checked the folder Hanselman refers to:
C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\ItemTemplates\CSharp\Web\MVC X\CodeTemplates\
While it exist in my VS 2013 installation it does not exist in my VS 2015 installation.
More diagnostics, and what I've done so far:
I would like to customize scaffolding Controllers and Views in my ASP.NET MVC 5 project using VS 2015. Ideally I would like to do this at project level, not globally overwriting developer machine level the templates. (as Hanselman's method allows it)
Any ideas or alternative mode to generate custom views and controllers based on EF entities (not starting from ground zero and reinventing the wheel)
Upvotes: 13
Views: 9133
Reputation: 7439
For visual studio 2015
the path to the templates have changed notice the 14 and web
C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\Microsoft\Web\Mvc\Scaffolding\Templates\MvcView
C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\Microsoft\Web\Mvc\Scaffolding\Templates\MvcView
Upvotes: 3
Reputation: 131729
ASP.NET MVC 5 stores the scaffolding templates in the Common7\IDE\Extensions\Microsoft\Web\Mvc
folder, both in Visual Studio 2013 and Visual Studio 2015. I found this thanks to Imran Baloch's post on customizing the Web API 2 templates.
Instead of version specific folders, there is a separate folder per template type that includes a version number
Upvotes: 11
Reputation: 64
I dont found the template but i have maybe a solution but i have not tested yet on VS2015, you can get the MvcScaffolding nuget package https://www.nuget.org/packages/MvcScaffolding/1.0.9 by Scott Hanselman and Steve Sanderson. It's a bit old but working on VS2013.
And link about the package on steven sanderson blog http://blog.stevensanderson.com/2011/01/13/scaffold-your-aspnet-mvc-3-project-with-the-mvcscaffolding-package/
Upvotes: 1