View scaffold templates in ASP.NET Core

前端 未结 3 1476
后悔当初
后悔当初 2020-12-10 09:52

MVC 5 has the very handy feature when creating a view to be able to select a template for scaffolding out the view. This uses a T4 template file to generate a CSHTML file b

3条回答
  •  南笙
    南笙 (楼主)
    2020-12-10 10:40

    Add following line in project.json under dependencies.

    "Microsoft.VisualStudio.Web.CodeGenerators.Mvc": "1.0.0-preview2-final",
    "Microsoft.VisualStudio.Web.CodeGeneration.Tools": "1.0.0-preview2-final"
    

    Also, add following under tools

    "Microsoft.VisualStudio.Web.CodeGeneration.Tools": "1.0.0-preview2-final"
    

    Save the file and it should restore the packages, restart Visual Studio if necessary.

    Now when you right click, you should see 'New Scaffolded Item...' option under 'Add'

提交回复
热议问题