Skip to content

Instantly share code, notes, and snippets.

@natemcmaster
Created June 24, 2015 22:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save natemcmaster/90e2388c0ee1d29f440a to your computer and use it in GitHub Desktop.
Save natemcmaster/90e2388c0ee1d29f440a to your computer and use it in GitHub Desktop.
dnx . ef migration add Initial
Using context 'MyContext'.
System.InvalidOperationException: A type named 'StartupProduction' or 'Startup' could not be found in assembly 'ef-xplat'.
at Microsoft.AspNet.Hosting.Startup.StartupLoader.FindStartupType (System.String startupAssemblyName, IList`1 diagnosticMessages) [0x00000] in <filename unknown>:0
at Microsoft.AspNet.Hosting.Internal.HostingEngine.EnsureStartup () [0x00000] in <filename unknown>:0
at Microsoft.AspNet.Hosting.Internal.HostingEngine.EnsureApplicationServices () [0x00000] in <filename unknown>:0
at Microsoft.AspNet.Hosting.Internal.HostingEngine.get_ApplicationServices () [0x00000] in <filename unknown>:0
at Microsoft.Data.Entity.Commands.ContextTool.TryCreateContextFromStartup (System.Type type, System.String startupAssemblyName) [0x00000] in <filename unknown>:0
at Microsoft.Data.Entity.Commands.ContextTool.CreateContext (System.Type type, System.String startupAssemblyName) [0x00000] in <filename unknown>:0
at Microsoft.Data.Entity.Commands.MigrationTool.CreateContext (System.Type type, System.String startupAssemblyName) [0x00000] in <filename unknown>:0
at Microsoft.Data.Entity.Commands.MigrationTool.AddMigration (System.String migrationName, System.String contextTypeName, System.String startupAssemblyName, System.String rootNamespace, System.String projectDir) [0x00000] in <filename unknown>:0
at Microsoft.Data.Entity.Commands.Program+<>c__DisplayClass11_0.<AddMigration>b__0 () [0x00000] in <filename unknown>:0
at Microsoft.Data.Entity.Commands.Program.Execute (System.String startupProject, System.Func`1 invoke) [0x00000] in <filename unknown>:0
at Microsoft.Data.Entity.Commands.Program.AddMigration (System.String name, System.String context, System.String startupProject) [0x00000] in <filename unknown>:0
at Microsoft.Data.Entity.Commands.Program+<>c__DisplayClass9_1.<Main>b__6 () [0x00000] in <filename unknown>:0
at Microsoft.Framework.Runtime.Common.CommandLine.CommandLineApplication.Execute (System.String[] args) [0x00000] in <filename unknown>:0
at Microsoft.Data.Entity.Commands.Program.Main (System.String[] args) [0x00000] in <filename unknown>:0
using Microsoft.Data.Entity;
public class MyContext : DbContext
{
public DbSet<Person> People { get; set; }
protected override void OnConfiguring(DbContextOptionsBuilder options)
{
options.UseSqlite("Data Source=./console_app.sqlite");
}
}
public class Person
{
public int Id { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
}
public class Program
{
public static void Main(string[] args)
{
using(var context = new MyContext())
{
context.Database.EnsureCreated();
}
}
}
{
"dependencies": {
"EntityFramework.Commands": "7.0.0-*",
"EntityFramework.Sqlite": "7.0.0-*"
},
"commands": {
"ef": "EntityFramework.Commands"
},
"frameworks": {
"dnx451": {}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment