Search code examples
asp.net-core-mvcasp.net-mvc-scaffolding

Custom scaffold templates in ASP.NET Core


Now that I figured out how to enable scaffolding in ASP.NET Core MVC (see View scaffold templates in ASP.NET Core), I'd like to create custom template files for Views. I found one place that said the template files are located here:

C:\Users\{user name}\.dnx\packages\Microsoft.Extensions.CodeGenerators.Mvc\1.0.0-rc1-final\Templates\ViewGenerator

But I copied an existing file there and that copied file does not appear in the Template dropdown on the Add View dialog. Are they located elsewhere, or do I have to do something to get files added in that folder to appear? Restarting Visual Studio did not do that.


Solution

  • I am using Microsoft.VisualStudio.Web.CodeGeneration.Tools 1.0.0-preview2-final

    Templates are located here...

    C:\Users\{username}\.nuget\packages\Microsoft.VisualStudio.Web.CodeGenerators.Mvc\1.0.0-preview2-final\Templates

    Copy the Templates folder to your project and edit them as required.

    enter image description here