I'm new to EF and am trying to create a simple test solution using VS 2017, .NET Core 2.0 and EF 2.0 but I can't get add-migration to create the migrations folder and the initial migration.
I have created a solution called Driver with two .Net Core class library projects:
Driver.Data
Driver.Domain
The following packages are installed in Driver.Data:
Microsoft.EntityFrameworkCore.SqlServer
Microsoft.EntityFrameworkCore.Tools
Driver.Data has a single cs file called 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;"
);
}
}
}
Driver.Domain has a single cs file called Company.cs:
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 startup project to Driver.Data and in the PM Console I've set the Default Project to Driver.Data
Here is the output of add-migration init -verbose:
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
There are no errors but nothing is being generated.