Entity Framework code first migrations throwing error

后端 未结 9 1613
再見小時候
再見小時候 2021-02-13 20:17

Here is what I did before I got this error:

  1. Installed EF (the pre release version, 6 maybe, I dunno)
  2. decided I did not want, so uninstalled that and reins
相关标签:
9条回答
  • 2021-02-13 20:45

    I have Windows 10. The following steps corrected the issue

    1. Open Program and Features and do a search for 'entity'
    2. I noticed an update was installed on 1/23/2016 after the 6.1.3 update on 7/22/2015
    3. Selected the 'Entity Framework 6.1.3' etc.. update
    4. Clicked on the "Repair" button. After the repair completed I restarted Visual Studio and issue no longer surfaced.

    Thanks to @Farshid for the initial clue to a resolution.

    0 讨论(0)
  • 2021-02-13 20:51
    1. Open Manage NUGET Packages for solution... window and update EntityFramework
    2. Restart Visual Studio
    3. Run the command in package manager console Enable-Migrations -ContextTypeName Movie.Models.MovieDBContext(This is a sample context)
    0 讨论(0)
  • I figured out the problem. EntityFramework.dll needed to be in the GAC for Visual Studio to use it from the package manager.

    1. Start Visual Studio Command Prompt (ensure you started Visual Studio as Administrator)
    2. Go to your packages directory and find the EntityFramework package directory.
    3. Go to lib\net45 (if targeting 4.5)
    4. type: gacutil /i EntityFramework.dll

    Note: It may be wise to restart the computer entirely at this point.

    I'm not sure why Visual Studio stopped seeing the DLL, but this got me past this problem.

    0 讨论(0)
提交回复
热议问题