[英]Entity Framework - The migrations configuration type was not be found in the assembly
[英]No migrations configuration type was found in the assembly 'ProjectName'
我正在尝试更新我的数据库和添加迁移。 我收到以下错误:
PM> 添加-迁移更新
在程序集“基础结构”中找不到迁移配置类型。 (在 Visual Studio 中,您可以使用 Package 管理器控制台中的 Enable-Migrations 命令来添加迁移配置)。
PM>启用迁移
在程序集“基础结构”中找不到上下文类型。
DbContext 位于 Infrastructure 内部。 我有五个以前的迁移已完成且没有错误。 在上次迁移和我现在尝试的迁移之间,我没有更改我的 DbContext 方法。
基础设施.数据:
namespace Infrastructure.Data
{
public class MovieshopDBContext : DbContext
{
//will generate the DB tables
public MovieshopDBContext(DbContextOptions<MovieshopDBContext> options) :base(options)
{
//specify options
}
public DbSet<Genre> Genres { get; set; }
public DbSet<Movie> Movies { get; set; }
public DbSet<Trailer> Trailers { get; set; }
public DbSet<Cast> Casts { get; set; }
public DbSet<Crew> Crews { get; set; }
public DbSet<Favorite> Favorites { get; set; }
public DbSet<MovieCast> MovieCasts { get; set; }
public DbSet<MovieCrew> MovieCrews { get; set; }
public DbSet<MovieGenre> MovieGenres { get; set; }
public DbSet<Purchase> Purchases { get; set; }
public DbSet<Review> Reviews { get; set; }
public DbSet<Role> Roles { get; set; }
public DbSet<User> Users { get; set; }
public DbSet<UserRole> UserRoles { get; set; }
}
}
我相信我已经安装了所有必要的依赖项和 NuGet 包。 我尝试过的事情:使用 -force 重建、重新运行命令。 重启机器。 检查Microsoft.docs.com 。
经过数小时的搜索,我找到了答案:
感谢:Henryk Budzinski on SO
完美地为我工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.