Visual Studio 2013 Scaffolding Error

前端 未结 9 770
小鲜肉
小鲜肉 2021-01-31 09:23

I\'m using VS 2013 RTM Ultimate, and when I try to add a Controller to my MVC 5 project I get the following error:

\"There was an error running the selected code generat

相关标签:
9条回答
  • 2021-01-31 09:47

    In case you do NOT have MVCScaffolding or T4Scaffolding packages installed and you encounter this bug/problem, check my solution here:

    Scaffolding controller doesn't work with visual studio 2013 update 2

    To sum up: the problem can be caused by the connection string. In my case I used localdb, I switched to a connection string to a standard sql server, then tried to generate the controller with MVC views and it worked.

    I tried to switch back the connection string to localdb, it didn't work. So that must have been the problem...

    0 讨论(0)
  • 2021-01-31 09:49

    Updgrade EntityFramework.

    Install-Package EntityFramework -Version 6.1.2 
    
    0 讨论(0)
  • 2021-01-31 09:50

    This situation is arriving when you already have T4Scaffolding used in one of your projects in the solution and you added the web project later. Uninstalling T4Scaffolding and T4Scaffolding.Core from package manager console resolved the issue. Somehow I lost the reference to EntityFramework also while uninstgalling the scaffolding, so I had to add the EntityFramework reference again.

    0 讨论(0)
提交回复
热议问题