abp icon indicating copy to clipboard operation
abp copied to clipboard

Unable to run database migration.

Open rupesh-adapty opened this issue 1 year ago • 3 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Description

The project was created following the instructions in the "Mastering ABP Framework" book.

The solution is created using: abp new ProductManagement

After defining the entities, the Web project is set as the startup project and in the PM Console, the EntityFrameworkCore project is set as default. On running the Add-Migration command, the error displayed is: Your startup project 'ProductManagement.DbMigrator' 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.

There was a similar bug reported but the issue was closed without a satisfactory resolution: https://github.com/abpframework/abp/issues/16785

Reproduction Steps

Follow instruction in Chapter 3 of the "Mastering ABP Framework" book up to page 38. On Page 38, the command Add-Migration "Added_Categories_And_Products" throws the error.

Expected behavior

No response

Actual behavior

No response

Regression?

No response

Known Workarounds

No response

Version

8.0.2

User Interface

MVC

Database Provider

EF Core (Default)

Tiered or separate authentication server

None (Default)

Operation System

Windows (Default)

Other information

No response

rupesh-adapty avatar Feb 04 '24 09:02 rupesh-adapty

hi

You can run dotnet ef migrations add MyName command under the EntityFrameworkCore project.

maliming avatar Feb 07 '24 00:02 maliming

error Hi, I have the same Issue, tried with Add-Migration and with dotnet ef migrations add NameMigration under EntityFrameworkCore project and is not working.

benrivero avatar May 24 '24 15:05 benrivero

hi @benrivero

You can try to use dotnet-ef instead of Add-Migration

https://learn.microsoft.com/en-us/ef/core/cli/dotnet

maliming avatar May 27 '24 01:05 maliming