question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Scaffolding MVC controller using EF crashes for 1.1

See original GitHub issue

Repro steps:

  1. Create new web application using individual accounts. (I am using .Net Core Preview 2 tooling). This will generate template web app using 1.0.0 packages.
  2. Update all packages to 1.1.0/1.1.0-preview4-final as applicable.
  3. Add new class Post.cs under models. (any properties are fine).
  4. Right click controllers folder, Add->Controller, MVC controller with views, using Entity Framework.
  5. Give model class as Post.cs and Data context class as ApplicationDbContext.

Nothing happens. Doing same controller add actions in 1.0.0 adds a new controller & views in the solution. Trying to execute the command manually (taken from output window) dotnet aspnet-codegenerator --project "c:\users\smpatel\documents\visual studio 2015\Projects\WebApplication2\src\WebApplication2" controller --force --controllerName PostsController --model WebApplication2.Models.Post --dataContext WebApplication2.Data.ApplicationDbContext --relativeFolderPath Controllers --controllerNamespace WebApplication2.Controllers --referenceScriptLibraries --useDefaultLayout shows aspnet-codegenerator.exe has crashed.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
prafullbhosalecommented, Dec 9, 2016

@wstaelens ,looks like your project.json is missing the Microsoft.VisualStudio.Web.CodeGeneration.Tools package in the tools section.

Can you try to add the below to the tools section and see if it works?

    "Microsoft.VisualStudio.Web.CodeGeneration.Tools": {
      "version": "1.1.0-preview4-final",
      "imports": [
        "portable-net45+win8+dnxcore50",
        "portable-net45+win8"
      ]
    }
0reactions
wstaelenscommented, Dec 11, 2016
Read more comments on GitHub >

github_iconTop Results From Across the Web

Visual Studio 2015 Update 1 crashes on Controller ...
This helps me: Close Visual Studio. Open administrative cmd in folder C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE ...
Read more >
ASP.NET MVC Scaffolders for Controller and View FORCE ...
When using the “Add Controller…” or “Add View…” scaffolder system to add a Controller or View to an ASP .NET MVC project, it...
Read more >
Scaffolding failed. Could not load information for project
I'm not able to scaffold my MVC Controller, with views, when my Library is unloaded. I've kept the reference, but it cannot find...
Read more >
Error when Scaffolding Controller with views, using Entity ...
In the MVC App: Right-Click on Controllers--> Add-->New Scaffold Item-->MVC Controller with views, using EF. Select the Model Class, ...
Read more >
How To Fix Common Errors Using ASP.NET MVC Scaffolding
A feature called Scaffolding creates a Controller and several ... We select the MVC 5 Controller with views, using Entity Framework option:.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found