mrahhal / Migrator.EF6

.NET Core CLI tool to enable EF6 migrations in an Asp.Net Core app.
MIT License
82 stars 15 forks source link

Your startup project 'BasicConsoleApp' doesn't reference Microsoft.EntityFrameworkCore.Design #71

Closed alpersilistre closed 4 years ago

alpersilistre commented 4 years ago

Hi @alpersilistre

Can you please open a new issue for this? But before that, maybe try to run the sample app that comes with this repository, just to know if the problem is in your project or the environment.

Originally posted by @mrahhal in https://github.com/mrahhal/Migrator.EF6/issues/61#issuecomment-554323692

Hi @mrahhal, I am creating this issue based on your comment.

I downloaded Migrator.EF6 1.0.8 tag solution from the repo. I opened the solution in the VS2015 and unloaded WithIdentity and Migrator.EF6.Tools projects. I rebuilt the BasicConsoleApp project and ran dotnet ef database update command from the Package Manager Console inside the BasicConsoleApp project folder. It successfully created a DB that I can see on my local. Then I deleted the DB and opened the project in the VS2017. Visual Studio migrated project files to csproj and removed the project.json file as expected. After rebuilt, I ran the same command dotnet ef database update and it gives me the error that I mentioned in the issue.

Your startup project 'BasicConsoleApp' doesn't reference Microsoft.EntityFrameworkCore.Design. This package is required for the Entity Framework Core Tools to work. Ensure your startup project is correct, install the package, and try again.

Then I add the deleted project.json file to the project as it was suggested in the previous issue but the same error occurred.

Then, I downloaded the 1.1.0 tag solution from the repo because it was already migrated to VS2017 (I read the changelog and it's say VS2017 support). I opened the solution in the VS2017 and unloaded the other 2 projects as I did before. Typed dotnet ef database update again but the error is still the same.

It seems I am having trouble running EF migration in the VS2017. I would be glad to hear your suggestions. Thank you.

mrahhal commented 4 years ago

Your startup project 'BasicConsoleApp' doesn't reference Microsoft.EntityFrameworkCore.Design. This package is required for the Entity Framework Core Tools to work. Ensure your startup project is correct, install the package, and try again.

It seems that you have a new dotnet core sdk installed. The new core sdk has a reserved dotnet ef command line tool that uses EFCore, so this conflicts with this repo's tool by name. As you can see from the readme, I changed the tool's name to dotnet ef6 from version 2.1.0. So you might have to install that and try with dotnet ef6.

alpersilistre commented 4 years ago

Yes, this was the problem. I updated to version 2.1.0 and typed 'dotnet ef6 database update' and it worked. Thank you for the guidance @mrahhal. I really appreciate it.

mrahhal commented 4 years ago

No worries.