开发者

MVC 3 & ASP.Net with Entity Framework scaffolding error : No model classes are available

I am trying to use MVC3 with the Entity framework with Code First, but the code Template generation process in MS Visual Web Developer 2010 - is not detecting my Model in the models folder - giving a message - "No Model classes are available" - although I do have model classes for which I want to create controllers.

The templating option I've selected is "Controller with read/write actions and views using the Entity Framework".

开发者_StackOverflow社区I've uninstalled and reinstalled Web Developer 2010, but still having the same error.

Anyone know how I can get around this error?


xixonia's response worked for me. All I needed to do was build/rebuild the project and then everything worked as expected.


Rebuild all did not fix this issue for me... until I closed Studio, reopened and rebuilt all. Then it worked like a charm.


After create models must be build your project. http://www.asp.net/mvc/tutorials/hands-on-labs/aspnet-mvc-4-entity-framework-scaffolding-and-migrations


I had this same issue and for me I had to go to the properties of the entity model in the entity model designer and change Code Generation Strategy to Default. It had been set to None because I had experimented with a DbContext generator.


I had this same issue.

While digging through my references, just before throwing the computer against the wall, I found that I had EntityFramework version 4.1 installed in the web project (by VS 2010 when the MVC 3 project was created).

I had 4.3.1 installed in the domain project (from nuget).

I uninstalled both of them and reinstalled from nuget.

Now everything is working again.

Hope this helps.


If you still have this problem then follow these steps to fix the problem:

1. Right click on your project and select [Manage NuGet Packages]
2. On the opened popup window, on the left hand pane, select Updates
3. On the right hand pane, at the very top right click on the Update All

During this process, it will ask you whether you want to overwrite the existing references (not sure about the exact phrase). So, say "Yes" to overwrite...

Now try to add the controller to your project and everything will be fine.

Good Luck!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜