I have a .NET Core class library that is the data access layer for multiple web applications. I am using Entity Framework Core 1.1, but I'm having trouble with migrations through PMC. My initial migration worked successfully, but after updating the database and re-launching VS 2017 I get a null exception on the contentRootPath argument when attempting to migrate. I may have made some changes to the project after my successful migration, but I don't remember what they were. This is the error and stack trace:
Both Entity Framework Core and Entity Framework 6 are installed. The Entity Framework Core tools are running. Use 'EntityFramework\Add-Migration' for Entity Framework 6. System.ArgumentNullException: Value cannot be null. Parameter name: contentRootPath at Microsoft.EntityFrameworkCore.Utilities.Check.NotEmpty(String value, String parameterName) at Microsoft.EntityFrameworkCore.Design.Internal.MigrationsOperations..ctor(IOperationReporter reporter, Assembly assembly, Assembly startupAssembly, String environment, String projectDir, String contentRootPath, String rootNamespace) at Microsoft.EntityFrameworkCore.Design.OperationExecutor.<>c__DisplayClass4_0.<.ctor>b__4() at Microsoft.EntityFrameworkCore.Internal.LazyRef`1.get_Value() at Microsoft.EntityFrameworkCore.Design.OperationExecutor.AddMigrationImpl(String name, String outputDir, String contextType) at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.<>c__DisplayClass3_0`1.<Execute>b__0() at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.Execute(Action action) There is no config file in my migrations directory, and I can't find anything related in the DbContext class. Has anyone else ran into this issue, or know what is causing it?
SqlDbContext class:
using Microsoft.EntityFrameworkCore; using DataLayer.Models.User; namespace DataLayer.Context { public class SqlDbContext : DbContext { public DbSet<User> Users { get; set; } protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) { optionsBuilder.UseSqlServer(MyDbConfig.SqlConnectionString); } protected override void OnModelCreating(ModelBuilder modelBuilder) { modelBuilder.Entity<User>() .Ignore(m => m.FullName); base.OnModelCreating(modelBuilder); } } }