Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 443 Vote(s) - 3.43 Average
  • 1
  • 2
  • 3
  • 4
  • 5
'Migrations' does not exist in the namespace 'Microsoft.EntityFrameworkCore'

#1
I'm doing a ASP.NET Core project.
I've installed `Microsoft.EntityFrameworkCore` and `Microsoft.EntityFrameworkCore.Tools` NuGet packages.

I ran `Add-Migration InitialCreate` command,
Which created `Migrations` folder and `20180905180349_InitialCreate.cs` file.

But it says

> The type or namespace name 'Migrations' does not exist in the
> namespace 'Microsoft.EntityFrameworkCore' (are you missing an assembly
> reference?)

What is the cause of this error. Do i need to install any other package ?


Reply

#2
Ok, I will show you the minimal setup required for EF Core + Migrations:

You will need to install Microsoft.EntityFramework.Core, but it is better that instead of that package you first install a EF Core provider for the database you will use. Then that EF Core provider will pull in all the required dependencies ( including Microsoft.EntityFramework.Core ) .

So (for example) for SQLServer db, in the Package Manager Console I will install:

1. **Install-Package Microsoft.EntityFrameworkCore.SqlServer**

2. **Install-Package Microsoft.EntityFrameworkCore.Tools** (for powershell commands)

3. **Install-Package Microsoft.EntityFrameworkCore.Design** (contains migrations engine - and **important** note this package has to be **inside executable project**)

And that's it.

Reply

#3
I faced a similar issue and found that I haven't installed `Microsoft.EntityFrameworkCore.SqlServer`. Initially, I have installed only `Microsoft.EntityFrameworkCore` and `Microsoft.EntityFrameworkCore.Tools`.

After installing `Microsoft.EntityFrameworkCore.SqlServer` problem gets resolved
Reply

#4
Including "Microsoft.EntityFrameworkCore.Design" was the answer to my problem.
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through