abpframework / abp

Open-source web application framework for ASP.NET Core! Offers an opinionated architecture to build enterprise software solutions with best practices on top of the .NET. Provides the fundamental infrastructure, cross-cutting-concern implementations, startup templates, application modules, UI themes, tooling and documentation.
https://abp.io
GNU Lesser General Public License v3.0
12.47k stars 3.36k forks source link

Unable to run database migration. #18928

Open rupesh-adapty opened 4 months ago

rupesh-adapty commented 4 months ago

Is there an existing issue for this?

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

maliming commented 4 months ago

hi

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

benrivero commented 1 month ago

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.

maliming commented 1 month ago

hi @benrivero

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

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