View scaffold templates in ASP.NET Core

巧了我就是萌 提交于 2019-11-28 10:37:39

You need to add references on Tools. But only for build time

in project.json, add the following to the dependencies section:

"Microsoft.VisualStudio.Web.CodeGeneration.Tools": {
  "version": "1.0.0-preview2-final",
  "type": "build"
},
"Microsoft.VisualStudio.Web.CodeGenerators.Mvc":  {
  "version": "1.0.0-preview2-final",
  "type": "build"
}

Still in project.json, locate the tools section and add the following

"Microsoft.VisualStudio.Web.CodeGeneration.Tools": {
  "version": "1.0.0-preview2-final",
  "imports": [
    "portable-net45+win8"
  ]
}

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'

I know this is old, but for me it was solved by opening the myProject.sln, it loaded the solution and then controller, etc options were available.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!