Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Missing Scaffolders ASP.Net Core

Traditionally there used to be scaffolding in Visual Studio to speed up adding controllers, areas, views, etc. After I installed ASP.NET Core, I noticed that all of these are gone, and this terrible (especially when you want to add a new area, it will be a terrible pain in the neck to manually do the job).

Is there any possible way to bring them back? Why would Microsoft team make such terrible decision?

enter image description here

like image 919
Arnold Zahrneinder Avatar asked Oct 08 '16 23:10

Arnold Zahrneinder


1 Answers

Is there any possible way to bring them back?

You need to add the necessary packages:

  • Microsoft.VisualStudio.Web.CodeGeneration.Tools
  • Microsoft.VisualStudio.Web.CodeGenerators.Mvc

Here is an example project.json file:

{
  "dependencies": {
    "Microsoft.NETCore.App": {
      "version": "1.0.1",
      "type": "platform"
    },
    "Microsoft.AspNetCore.Mvc": "1.0.1",
    "Microsoft.AspNetCore.Hosting": "1.0.0",
    "Microsoft.AspNetCore.StaticFiles": "1.0.0",
    "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"
    }
  },
  "tools": {
    "Microsoft.VisualStudio.Web.CodeGeneration.Tools": {
      "version": "1.0.0-preview2-final",
      "imports": [
        "portable-net45+win8"
      ]
    }
  },
  "frameworks": {
    "netcoreapp1.0": {
      "imports": [
        "dotnet5.6",
        "portable-net45+win8"
      ]
    }
  }
}

After adding those packages, you will have access to the scaffolding.

enter image description here

For reference, the above screenshot is from Visual Studio 2015 Update 3 with these relevant extensions:

  • Microsoft .NET Core Tools
  • Microsoft ASP.NET and Web Tools
  • Microsoft ASP.NET Web Frameworks and Tools
like image 135
Shaun Luttin Avatar answered Nov 12 '22 05:11

Shaun Luttin