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

10,471

Solution 1

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

Solution 2

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

Solution 3

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

Share:
10,471
André Vermeulen
Author by

André Vermeulen

Code Mentor at Project codeX in Cape Town.

Updated on June 04, 2022

Comments

  • André Vermeulen
    André Vermeulen about 2 years

    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".

    I've uninstalled and reinstalled Web Developer 2010, but still having the same error.

    Anyone know how I can get around this error?

  • André Vermeulen
    André Vermeulen about 13 years
    Indeed building the project solved the issue. There is even a little popup - which shows up from time to time - which confirms whether the project has been compiled.
  • Rick Arthur
    Rick Arthur almost 13 years
    Just rebuilding didn't fix my problem, but when I did 'Build/Clean Solution', then did a 'Build/Rebuild Solution', that did the trick for me.
  • Hanxue
    Hanxue over 11 years
    I concur with Larry S's answer below - cleaning and rebuilding the solution does not solve the problem. The error only disappear after I restarted Visual Studio. Reported a bug at connect.microsoft.com/VisualStudio/feedback/details/774878/…
  • ShaunOReilly
    ShaunOReilly about 11 years
    Had to rebuild entire solution too!