Entity Framework Core 2.0 add-migration not generating anything

.net-core c# entity-framework visual-studio-2017

Question

I'm attempting to develop a simple test solution using VS 2017,.NET Core 2.0, and EF 2.0 since I'm new to the technology, but I'm having trouble getting add-migration to generate the migrations folder and the first migration.

My solution, Driver, consists of two.Net Core class library projects:

Driver.Data
Driver.Domain

In Driver.Data, the following applications are installed:

Microsoft.EntityFrameworkCore.SqlServer
Microsoft.EntityFrameworkCore.Tools

Driver.Data only has one cs file, Driver.Context:

using Driver.Domain;
using Microsoft.EntityFrameworkCore;

namespace Driver.Data
{
    public class DriverContext : DbContext
    {
        public DbSet<Company> Companies { get; set; }

        protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        {
            optionsBuilder.UseSqlServer(
                "Server=(localdb)\\mssqllocaldb; Database=Driver; Trusted_Connection=True;"
                );
        }
    }

}

One CS file, Company.cs, is present in Driver.Domain.

namespace Driver.Domain
{
    public class Company
    {
        public int Id { get; set; }
        public string Name { get; set; }
        public string City { get; set; }
        public string State { get; set; }
    }
}

I've set the starter project to Driver.Data and the default project to Driver.Data in the PM Console.

The output of -verbose add-migration init is as follows:

Using project 'Driver.Data'.
Using startup project 'Driver.Data'.
Build started...
Build succeeded.
C:\Program Files\dotnet\dotnet.exe exec --depsfile "C:\Users\alex.florin\Documents\Visual Studio 2017\Projects\Driver\trunk\Driver.Data\bin\Debug\netcoreapp2.0\Driver.Data.deps.json" --additionalprobingpath C:\Users\alex.florin\.nuget\packages --additionalprobingpath "C:\Program Files (x86)\Microsoft SDKs\NuGetPackagesFallback" --additionalprobingpath "C:\Program Files\dotnet\sdk\NuGetFallbackFolder" --fx-version 2.0 "C:\Program Files\dotnet\sdk\NuGetFallbackFolder\microsoft.entityframeworkcore.tools\2.0.1\tools\netcoreapp2.0\ef.dll" migrations add init --json --verbose --no-color --prefix-output --assembly "C:\Users\alex.florin\Documents\Visual Studio 2017\Projects\Driver\trunk\Driver.Data\bin\Debug\netcoreapp2.0\Driver.Data.dll" --startup-assembly "C:\Users\alex.florin\Documents\Visual Studio 2017\Projects\Driver\trunk\Driver.Data\bin\Debug\netcoreapp2.0\Driver.Data.dll" --project-dir "C:\Users\alex.florin\Documents\Visual Studio 2017\Projects\Driver\trunk\Driver.Data\\" --root-namespace Driver.Data

Nothing is being created, yet there are no errors.

1
5
1/4/2018 7:42:03 PM

Accepted Answer

ZZZ_tmp
18
4/17/2018 10:48:21 PM

Popular Answer

ZZZ_tmp


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow