Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EF 6.4 migrations running in an ASP.NET CORE 3 app not working #1524

Closed
slask opened this issue Dec 12, 2019 · 3 comments
Closed

EF 6.4 migrations running in an ASP.NET CORE 3 app not working #1524

slask opened this issue Dec 12, 2019 · 3 comments

Comments

@slask
Copy link

slask commented Dec 12, 2019

I have an ASP.NET core 3.0 app and I am running EF 6.4 on it. Queries works ok but I need to apply migrations to target DB from command line during Continuous Integration.

What is the exact command to run for that? I tried various options and none of them worked and the docs are just terrible on this.

Migrations in:
EF 6.4 + .NET Full 4.x = OK
EF Core 3.0 + .NET Core 3.0 = OK
EF 6.4 + .NET Core 3.0 = HOW?

Key points:

  • EF 6.4 running on .NET Core 3.0, so no web.config just appsetting.json
  • I need to run from command line not from Visual Studio's Package Manager Console
  • in .NET Core 3 project where is no NuGet "packages" folder where do I get the ef6 CLI tool from?

Further technical details

EF version: 6.4
Database Provider: EntityFramework.SqlServer
Operating system: Windows 10
IDE: VS2019

Others are having the same problem: #1053 (comment)

@phekmat
Copy link

phekmat commented Jan 17, 2020

As an aside, the (unfriendly) command in the linked issue is close, but has the --assembly switch in the wrong place. It should go after the EF specific command (e.g. migrations add):

dotnet exec \
  --depsfile ./bin/Debug/netcoreapp3.0/MyApp.deps.json \
  --runtimeconfig ./bin/Debug/netcoreapp3.0/MyApp.runtimeconfig.json \
  ~/.nuget/packages/entityframework/6.3.0/tools/netcoreapp3.0/any/ef6.dll \
  database update
  --assembly ./bin/Debug/netcoreapp3.0/MyApp.dll \
  <other database update options>

The nuget package cache is in %userprofile%\.nuget\packages (Windows) or ~/.nuget/packages by default.

@spacestr
Copy link

Also make sure that you run the 32bit version of 'dotnet' (ex: C:\Program Files (x86)\dotnet) if your project targets x86 architecture.

@ajcvickers
Copy link
Member

This issue has been closed because EF6 is no longer being actively developed. We are instead focusing on stability of the codebase, which means we will only make changes to address security issues. See the repo README for more information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants