2

When trying to create a new ADO.NET entity data model (code first from existing database), I can no longer do so. I first create one with the name 'ReportsModel' but then I deleted the classes at some point, and the connection string. I basically have no trace of that keyword anywhere in my entire solution (searced both in VS as well as using notepad++ in all subfolders of solution)

Later on I decided to use that name but I'm still getting this error when I try to create the data model with that name.

enter image description here

I tried the suggestions in this post How to properly delete and re-add Entity Data Model

But none helped me (restarting VS, cleaning and rebuilding project, making sure no connection string present in App.config, I also deleted everything from obj and bin folders and unloaded reloaded my project and rebuilt) Nothing seems to help.

NOTE: my project is a .net framework console app

Does anyone know how to actually solve this and what is causing the issue?

EDIT: I think something (either visual studio or entity framework) is saving this information somewhere outside the solution because I added a new project to my solution and tried to do the same thing within it, but it gave the same error even though its a brand new project and I never created any data models in it yet. So how could it possibly know of the model I tried creating in the other project.

I also tried to delete the servers and data connections from the server explorer and that didn't help either.

I have no Application Settings defined for the project yet. So I don't know what application settings its referring to.

erotavlas
  • 4,274
  • 4
  • 45
  • 104
  • Are you trying to create a database with a same name? Please check your connection string and the database server instance. – Tejus Apr 09 '19 at 22:26
  • @Tejus database already exists, I'm reverse engineering - code first from database. – erotavlas Apr 09 '19 at 22:27
  • Oh sorry. my bad. I misunderstood your question. Have you checked your App.Config file? Probably it has traces of your previous created connection strings. – Tejus Apr 09 '19 at 22:29

1 Answers1

-1

My first solution is just rebuilding the project. second solution is giving a different Model Namespace, delete the Entity Data Model, recreate a new Entity Data Model with the Model Namespace which you want.

Sounds stupid, but it works for me.

Bhargav Rao
  • 50,140
  • 28
  • 121
  • 140
steven
  • 1
  • 1