Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

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

DZone's Guide to

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

· Web Dev Zone ·
Free Resource

Code something amazing with the IBM library of open source blockchain patterns. Content provided by IBM.

Introduction:


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.

Description:

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

Summary:

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.

Start coding something amazing with our library of open source Cloud code patterns. Content provided by IBM.

Topics:
dotnet ,how-to ,microsoft ,tools ,web ,asp.net

Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

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

{{ parent.tldr }}

{{ parent.urlSource.name }}