Namespace cannot be found when rebuilding entity framework

13,455

Solution 1

Lo and behold, it was simple. I named the connection string to a different name than the object name I call in my code!

Solution 2

Today I faced the same issue and waste my entire day.

Finally I start reading errors line by line and found the exact error.

  1. On two tables I removed relationship and that was all the cause of problem.
  2. Even I added all the relationship and update model but still not working.
  3. Removed those tables from emdx on which I removed and re-added relationship
  4. rebuild and found everything gone except the removed tables
  5. Added those tables and done
Share:
13,455
user2284341
Author by

user2284341

Updated on June 05, 2022

Comments

  • user2284341
    user2284341 almost 2 years

    I've rebuilt my entity framework in an MVC 3 project. This was working before I did this. Now though, I get the error:

    The type or namespace name 'myEntities' could not be found (are you missing a using directive or an assembly reference?)    
    

    everywhere in my code where it references the Entity Framework. This was working before the rebuild so it follows that it has to be that. I've checked that the name of the connection in my web.config and have deleted and re-installed the entity framework but it's not being referenced.

    Any ideas how to fix this error?

  • user2284341
    user2284341 over 10 years
    Yes, I've seen this post. It doesn't help much. I think it's something I did wrong while setting it up.
  • user2284341
    user2284341 over 10 years
    To clarify, I didn't use NuGet or need to add the EF's dll in the Reference before and it was fine. It may solve the problem but I don't want to go down a longer root if the answer's more simple than that.
  • Jamie
    Jamie over 5 years
    Mine was the same, in the Model.Context.cs, it updated the name of my Entities to Dev and I had to change it back to what I was using in every reference in my code.