7

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?

1
  • 4
    Sometimes this happens and the project just needs to be rebuilt. Have you tried this already? Commented Apr 16, 2011 at 15:53

6 Answers 6

14

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

Sign up to request clarification or add additional context in comments.

4 Comments

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.
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.
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/…
Had to rebuild entire solution too!
8

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

Comments

1

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

Comments

0

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.

Comments

0

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.

Comments

0

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!

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.