visual-studiovisual-studio-2017asp.net-mvc-scaffoldingasp.net-core-1.1

ASP.NET Core Scaffolding does not work in VS 2017


I have a beginner ASP.NET Core project in Visual Studio 2017, and I am at the scaffolding step of the HelloWorld. The Scaffolding does not work, I tested on a first computer, then at a second one...

when I try to generate a controller with views enter image description here , it gives the following error on the first machine:

Microsoft Visual Studio


Error

There was an error running the selected code generator:

'Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.VisualStudio.Web.CodeGeneration.Utils, Version=1.1.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified. at Microsoft.VisualStudio.Web.CodeGeneration.Design.Program.Main(String[] args)'


OK

On the second machine:

Microsoft Visual Studio


Error

There was an error running the selected code generator:

'Error: assembly specified in the dependencies manifest was not found -- package: 'microsoft.applicationinsights.aspnetcore', version: '2.1.0', path: 'lib/netstandard1.6/Microsoft.ApplicationInsights.AspNetCore.dll''


OK


Solution

  • The following works for me.

    I deleted bin & obj folders, build the project again and it works.

    In case if it gives you error: it couldn't find project.deps.json in debug folder.

    Set project to debug, ran it and now you can add scaffolded items.