1

I'm trying to to set up a new database/migrations with Entity Framework Core (version 1.1.0) on a .NET application.

PM> Add-Migration InitialMigration
Cannot execute this command because Microsoft.EntityFrameworkCore.Design is not installed. Install the version of that package that matches the installed version of Microsoft.EntityFrameworkCore and try again.

I have already installed Microsoft.EntityFrameworkCore.Design (along with Tools (version 1.1.0-preview4-final), and the Relational/Relational.Design and Sqlite packages). I can see this in the Nuget package manager.

Now this does seem similar to this Q&A - Entity Framework Core 1.0.1 add-migration - but there's a few differences, mainly there is no project.json anywhere, and the error message is slightly different.

There is a packages.config file which has this in it.

  <package id="Microsoft.EntityFrameworkCore" version="1.1.0" targetFramework="net46" />
  <package id="Microsoft.EntityFrameworkCore.Design" version="1.1.0" targetFramework="net46" />
  <package id="Microsoft.EntityFrameworkCore.Relational" version="1.1.0" targetFramework="net46" />
  <package id="Microsoft.EntityFrameworkCore.Relational.Design" version="1.1.0" targetFramework="net46" />
  <package id="Microsoft.EntityFrameworkCore.Sqlite" version="1.1.0" targetFramework="net46" />
  <package id="Microsoft.EntityFrameworkCore.Tools" version="1.1.0-preview4-final" targetFramework="net46" developmentDependency="true" />
2
  • This is somehow related but not similar as you have packages.config and they have packages.json file: stackoverflow.com/questions/38306791/… Commented Dec 5, 2016 at 15:47
  • When you say "I have already installed Microsoft.EntityFrameworkCore.Design (along with Tools (version 1.1.0-preview4-final), and the Relational/Relational.Design and Sqlite packages)", did you install 1.1.0 using Nuget Beta Channel? If not, can you try that? Commented Dec 5, 2016 at 18:58

3 Answers 3

1

Make sure that you have the project selected in the package manager console that has EntityFramework Installed.

Sign up to request clarification or add additional context in comments.

1 Comment

I have done that but still get the above error messages. It's a multi project solution and I'm selecting the project which implements the DbContext and has all the EntityFrameworkCore references installed from Nuget.
1

I had to install the Microsoft.EntityFrameworkCore.Design package in not only the class library that implemented the DbContext class, but also in the project (in this case the GUI/WinForms project) that referenced said class library. This was despite having selected the class library in the Package Manager Console as user Derek suggested.

Once I did this I was able to run the Add-Migration command and related commands.

Comments

0

Do you have the LTS (1.0.x) rumtime installed? Find it on the downloads page.

(It may not help, but it's one possible issue.)

1 Comment

Assuming you mean .NET Core, I'll give this a go. Also updated from Visual Studio 2015 'Update 2' to 'Update 3' last night, just in case this has something to do with it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.