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.
From Solution Explorer, right-click on the project > Add > New Scaffolded Item. From the left pane of the Add Scaffold dialog, select Identity > Add. In the Add Identity dialog, select the options you want. Select your existing layout page so your layout file isn't overwritten with incorrect markup.
Scaffold templates are used to generate code for basic CRUD operations within your ASP.NET MVC applications against your database with the help Entity Framework. These templates use the Visual Studio T4 templating system to generate views for basic CRUD operations with the help of Entity Framework.
To add a scaffold, right-click on Controllers folder in the Solution Explorer and select Add → New Scaffolded Item. It will display the Add Scaffold dialog. Select MVC 5 Controller with views, using Entity Framework in the middle pane and click 'Add' button, which will display the Add Controller dialog.
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.
I´m using Visual Studio 2017 and asp.net Core 2.0, and after search a lot, I´ve just found the Templates on this place: C:\Program Files\dotnet\sdk\NuGetFallbackFolder\microsoft.visualstudio.web.codegenerators.mvc\2.0.0\Templates
I hope this could help someone with the same issue... ;)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With