1

I noticed after creating a new project in Visual Studio 2017 of the type "ASP.NET Core Web Application (.NET Framework)", there is no scaffolding (when you right click) menu item available (like in the older versions of MVC).

Is scaffolding not available for DotNet Core 1.1?

Is there some special setting or NuGet package that must be added?

(I tried some suggestions out there like the Microsoft.VisualStudio.Web.CodeGenerators.Mvc and some others, but no joy)

Sanket
  • 19,295
  • 10
  • 71
  • 82
DaveN
  • 888
  • 2
  • 8
  • 16

1 Answers1

3

Newly created ASP.NET Core Project, Right-click on the Controllers folder in Solution Explorer and select Add > New Scaffolded Item.

This will ask for Add MVC Dependencies dialog. In this, select Minimal Dependencies, and select Add.

enter image description here

Visual Studio adds the dependencies needed to scaffold a controller, including a package with design-time EF functionality (Microsoft.EntityFrameworkCore.Design). A package that is needed only for scaffolding a DbContext from an existing database is also included (Microsoft.EntityFrameworkCore.SqlServer.Design).

After this, when you right click on the Controllers folder in Solution Explorer and select Add > New Scaffolded Item.

This will give you 'Add Scaffold' dialog box where you can select options like MVC controller with views, using Entity Framework

enter image description here

Hope this will help.

Sanket
  • 19,295
  • 10
  • 71
  • 82
  • I voted this up as it's the correct answer but I will warn you that even after doing this I have had some issues with scaffolding still now working. I would advise you to learn how to do all this work manually anyways so that you better understand what the scaffolding is doing behind the scene. – Jason H May 27 '17 at 15:13
  • It was that simple. Need to remember this :) – DaveN May 28 '17 at 20:06
  • Decided to not go with DotNetCore, a full week has gone by and nothing to show for it (except frustration, errors, and stop signs). I'll wait for version 2.0 to come along - rather do that than be an unpaid Microsoft debugger! – DaveN May 31 '17 at 01:42