I'm following the following tutorial:
and I came across a problem with using entity framework to create a new database for my app. Running the command dnx ef migrations add MyFirstMigration
throws me this error:
System.IO.FileLoadException: Could not load file or assembly 'KeepItSolved, Culture=neutral, PublicKeyToken=null' or one of its dependencies. General Exception (Exception from HRESULT: 0x80131500) File name: 'KeepItSolved, Culture=neutral, PublicKeyToken=null' ---> Microsoft.Dnx.Compilation.CSharp.RoslynCompilationException: /home/demo/kistest/src/KeepItSolved/Migrations/20160414215220_InitialMigration.cs(17,74): DNXCore,Version=v5.0 error CS0103: The name 'SqlServerValueGenerationStrategy' does not exist in the current context /home/demo/kistest/src/KeepItSolved/Migrations/20160414215220_InitialMigration.cs(69,74): DNXCore,Version=v5.0 error CS0103: The name 'SqlServerValueGenerationStrategy' does not exist in the current context /home/demo/kistest/src/KeepItSolved/Migrations/20160414215220_InitialMigration.cs(89,74): DNXCore,Version=v5.0 error CS0103: The name 'SqlServerValueGenerationStrategy' does not exist in the current context /home/demo/kistest/src/KeepItSolved/Migrations/20160414215220_InitialMigration.Designer.cs(18,69): DNXCore,Version=v5.0 error CS0103: The name 'SqlServerValueGenerationStrategy' does not exist in the current context /home/demo/kistest/src/KeepItSolved/Migrations/SolvedContextModelSnapshot.cs(17,69): DNXCore,Version=v5.0 error CS0103: The name 'SqlServerValueGenerationStrategy' does not exist in the current context /home/demo/kistest/src/KeepItSolved/Models/SolvedContext.cs(29,19): DNXCore,Version=v5.0 error CS1061: 'DbContextOptionsBuilder' does not contain a definition for 'UseSqlServer' and no extension method 'UseSqlServer' accepting a first argument of type 'DbContextOptionsBuilder' could be found (are you missing a using directive or an assembly reference?) /home/demo/kistest/src/KeepItSolved/Startup.cs(71,18): DNXCore,Version=v5.0 error CS1061: 'EntityFrameworkServicesBuilder' does not contain a definition for 'AddSqlServer' and no extension method 'AddSqlServer' accepting a first argument of type 'EntityFrameworkServicesBuilder' could be found (are you missing a using directive or an assembly reference?) at Microsoft.Dnx.Compilation.CSharp.RoslynProjectReference.Load(AssemblyName assemblyName, IAssemblyLoadContext loadContext) at Microsoft.Dnx.Compilation.CompilationEngine.LoadProject(Project project, FrameworkName targetFramework, String aspect, IAssemblyLoadContext loadContext, AssemblyName assemblyName) at Microsoft.Dnx.Runtime.Loader.ProjectAssemblyLoader.Load(AssemblyName assemblyName, IAssemblyLoadContext loadContext) at Microsoft.Dnx.Runtime.Loader.ProjectAssemblyLoader.Load(AssemblyName assemblyName) at Microsoft.Dnx.Host.LoaderContainer.Load(AssemblyName assemblyName) at Microsoft.Dnx.Host.DefaultLoadContext.LoadAssembly(AssemblyName assemblyName) at Microsoft.Dnx.Runtime.Loader.AssemblyLoaderCache.GetOrAdd(AssemblyName name, Func2 factory) at Microsoft.Dnx.Runtime.Loader.LoadContext.Load(AssemblyName assemblyName) at System.Runtime.Loader.AssemblyLoadContext.LoadFromAssemblyName(AssemblyName assemblyName) at System.Runtime.Loader.AssemblyLoadContext.Resolve(IntPtr gchManagedAssemblyLoadContext, AssemblyName assemblyName) at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) at System.Reflection.Assembly.Load(AssemblyName assemblyRef) at Microsoft.Data.Entity.Design.Internal.StartupInvoker..ctor(String startupAssemblyName, String environment) at Microsoft.Data.Entity.Design.DbContextOperations..ctor(ILoggerProvider loggerProvider, String assemblyName, String startupAssemblyName, String environment) at Microsoft.Data.Entity.Design.MigrationsOperations..ctor(ILoggerProvider loggerProvider, String assemblyName, String startupAssemblyName, String environment, String projectDir, String rootNamespace) at Microsoft.Data.Entity.Commands.Program.Executor.<>c__DisplayClass4_1.<.ctor>b__4() at Microsoft.Data.Entity.Internal.LazyRef`1.get_Value() at Microsoft.Data.Entity.Commands.Program.Executor.<>c__DisplayClass6_0.b__0() at Microsoft.Data.Entity.Commands.Program.Executor.Execute(Action action) Could not load file or assembly 'KeepItSolved, Culture=neutral, PublicKeyToken=null' or one of its dependencies. General Exception (Exception from HRESULT: 0x80131500)
User contributions licensed under CC BY-SA 3.0