简体   繁体   中英

Use MVC 4 style scaffolding in VS 2015 Update 3

I am updating a few year old website which was originally built with MVC4 (VS2012 perhaps). I am pretty sure after update 3 when I add a new view using scaffolding I now get the MVC5 style views using Bootstrap, etc. This site doesn't use bootstrap and there are no plans to add it at this time. Is there a way to reference the old style scaffolding template so I don't need to build (or rebuild) the view pages by hand after they created?

Currently using VS2015 Update 3

It appears that nuget package Microsoft.AspNet.Mvc is running 5.2.3. Is this the reason I am getting MVC 5 scaffolding templates?

Scaffolding uses Code Templates, but only to define the Create, List, Edit, Details,Delete and Empty Views. It means that the css are inherited from your _Layout.cshtml. Just remove the bootstrap reference from that and it should work. If you want to customize your Scaffolding layouts, just change the Code Template:

C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\Common7\\IDE\\ItemTemplates\\CSharp\\Web\\MVC 4\\CodeTemplates\\AddView\\CSHTML

More info: http://www.hanselman.com/blog/ModifyingTheDefaultCodeGenerationscaffoldingTemplatesInASPNETMVC.aspx

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM