Copying project does not retain Entity Framework connection

1

I'm moving my project from one machine to another. I simply zipped the project folder and moved it to my new computer. My project is an asp.net mvc application with Entity Framework. I have my connection string in my web.config file. When I run my application on my new machine, it has trouble connecting to the database it seems.

I get this error when trying to create a dbcontext

[SqlException (0x80131904): There is already an object named 'Merchandises' in the database.]

But the odd thing is it runs perfectly fine on my old machine.

I executed add-migration command and it says I'm very behind in migrations but this is not true.

Unable to generate an explicit migration because the following explicit migrations are pending: [201802070210548_Initial_Migration, 201802130149472_Added_TrackForm, 201802181945057_Added_DOB]. Apply the pending explicit migrations before attempting to generate a new explicit migration.

Any assistance for debugging this would be greatly appreciated.

c#
asp.net-mvc
entity-framework
entity-framework-6
entity-framework-core
asked on Stack Overflow Nov 7, 2018 by Master • edited Nov 7, 2018 by marc_s

1 Answer

0

You can remove all migrations and add only one that named Initial_Migration ( add-migration 'Initial_Migration' and update-database).

--- reference from github.

answered on Stack Overflow Nov 7, 2018 by Ashiquzzaman

User contributions licensed under CC BY-SA 3.0