locked
Add-Migration: Package manager console goes unresponsive RRS feed

  • Question

  • Hi,

    I have added the new model class and also included it in the DbContext.cs file.

    Initially, when I ran the Add-Migration command then relevant .cs file was added to the project successfully.

    Later I ran the Update-Database command and terminated it in between the process.

    Because I wanted to rename the generated migration file, I went ahead and deleted the previously generated .cs file and ran the Add-Migration command again. But since then nothing is happening using package manager, it simply goes into the unresponsive mode and result is never returned, It doesn't even stop the command execution.

    Any clue why this is happening or what needs to be done to solve this?


    Bhushan Gawale | RapidCircle

    Friday, May 19, 2017 12:52 PM

Answers

  • Thanks everyone for their inputs. 

    It was due to the minor mistake, the connection string in the configuration file of the project containing data context was pointing to wrong database.


    Bhushan Gawale | RapidCircle

    Monday, May 22, 2017 9:25 AM

All replies

  • Hi Bhushan Gawale,

    please delete the folder named "Migrations" in your project, then delete the table named "__MigrationHistory" in your database. 

    1. Run the Enable-Migrations command in Package Manager Console.

    2. Add-Migration will scaffold the next migration based on changes you have made to your model since the last migration was created

    3. Update-Database will apply any pending migrations to the database

    Best regards,

    Cole Wu


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    Monday, May 22, 2017 6:48 AM
  • Yup, Enable-Migrations should do it.

    PS: Kindly close threads by marking answers where appropriate. Thank you.

    Monday, May 22, 2017 9:23 AM
  • Thanks everyone for their inputs. 

    It was due to the minor mistake, the connection string in the configuration file of the project containing data context was pointing to wrong database.


    Bhushan Gawale | RapidCircle

    Monday, May 22, 2017 9:25 AM