2

I'm working on a little project and after a while, my model and data context classes disappeared from the Add Controller window.

I have generated one controller with views normally before.

Of course, I have built, rebuilt, cleaned and rebuilt, cried, cursed and threatened my computer, none of them worked.

Some useful information (or not-so-useful):

  • I'm using MVC4 Beta.
  • I'm using VS2010, but I have VS11 Beta installed.
  • I've used the "old" SPA Scaffolding, after I updated it and edited the templates this problem appeared.
  • At first, I saw a gigantic list in the dropdown menus filled with classes from a few packages I've installed, namely DataAnnotations, WebActivator and json.NET. After I uninstalled them (since I wasn't using them yet),I got a "no model classes are available" message.
  • I've added some Test Data to my data context class using a custom initializer.

Thank you very much.

tereško
  • 58,060
  • 25
  • 98
  • 150
rafasoares
  • 425
  • 5
  • 18

2 Answers2

2

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!

Vincy
  • 1,078
  • 1
  • 9
  • 16
-1

Have you considered "searching" on entire project for the DataAnnotations and other stuff you uninstalled?? (I don't know if you mean it by "cleaned and rebuilt").

Have you tried to install these "bad stuff" again in order to get your stuff working again?

Well, i would start this way, and then after cursing, smoking, and knocking my head against a wall... i would consider getting high and starting all over again...

Good luck pal!

  • I haven't, but I know I didn't use any of them, also, with them installed my entity classes didn't show up anyway. And the same thing happenend in another computer in a project that never had those packages (in fact, it was a brand new MVC 4 SPA project, just with some model classes) and I haven't installed VS11 beta. Suddenly all models disappeared from the new controller window. I'm gonna check it again tomorrow to see if I can find anything that I might have screwed up. – rafasoares Mar 29 '12 at 02:38