Over a million developers have joined DZone.

Customizing ASP.NET MVC 5/Web API 2 Scaffolding Templates in Visual Studio 2013

· Web Dev Zone

Start coding today to experience the powerful engine that drives data application’s development, brought to you in partnership with Qlik.


Scaffolding in ASP.NET allows you to automatically generate code in web application. This make it easy to quickly add boilerplate code in your application. There is a nice introduction of scaffolding in ASP.NET application using Visual Studio 2013 at here. The default templates are good for a lot of cases, but sometimes you want to customize these scaffolding templates for all your applications and sometimes you need to use different scaffolding templates in different projects. In this article, I will show you how to customize the default scaffolding t4 templates in ASP.NET MVC 5 and ASP.NET Web API 2 globally and per project.


If you need to customize the scaffold templates globally then just navigate to C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\Extensions\Microsoft\Web\Mvc\Scaffolding\Templates(depending upon where Visual studio reside),

In the above explorer, you can globally update the t4 templates of ASP.NET MVC 5 and ASP.NET Web API 2.

Now for per project base, just create a CodeTemplates folder in your application root and paste the above folders inside CodeTemplates folder,

You can read more about this at here


In this article, I showed you how you can easily customize the default code generation(scaffolding) templates in ASP.NET MVC 5 and ASP.NET Web API 2 using Visual Studio 2013. Hopefully you will enjoy my this article too.

Create data driven applications in Qlik’s free and easy to use coding environment, brought to you in partnership with Qlik.


Published at DZone with permission of Imran Baloch, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}