0

I need to custumize the scaffolding templates in asp.net mvc5. But I could not find the related the files.

Also is it possible to put paging or export options to scafffolding template ?

Regards.

0

1 Answer 1

3

Below is how I customized my scaffold template for the BaseController. You can customize more templates by follow these steps and pick up the right template you want to customize.

  1. Create folder call "CodeTemplate" directly in the project folder.

  2. Go to below path, find MvcControllerWithActions folder copy all to folder "CodeTemplates"

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

  3. Go to CodeTemplates -> MvcControllerWithActions in your project.

  4. There are two files, Controller.cs.t4 and Controller.vb.t4 in MvcControllerWithActions, if you used C#, delete Controller.vb.t4.

  5. Open the Controller.cs.t4 file, modify the Controller name to BaseController, like below:

    public class <#= ControllerName #> : BaseController { }

  6. Now, when you try to create MVC5 Controller using "add new scaffold item", it'll use the template you customized

.

Hope it helps.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.