我想在asp.net MVC 6中使用Entity Framework 7中的数据迁移创建数据库。但是我遇到了以下问题:
C:\ Users \ Elpic04 \ Documents \ Visual Studio 2015 \ Projects \ ContosoBooks \ src \ ContosoBooks> dnx ef。迁移添加 初始
System.InvalidOperationException:无法从中解析项目'ef' C:\ Users \ Elpic04 \ Documents \ Visual Studio 2015 \ Projects \ ContosoBooks \ src \ ContosoBooks \ ef at Microsoft.Framework.Runtime.ApplicationHostContext..ctor(的IServiceProvider serviceProvider,String projectDirectory,String packagesDirectory, 字符串配置,FrameworkName targetFramework,ICache缓存, ICacheContextAccessor cacheContextAccessor, INamedCacheDependencyProvider namedCacheDependencyProvider, IAssemblyLoadContextFactory loadContextFactory,Boolean skipLockFileValidation)at Microsoft.Framework.Runtime.DefaultHost.Initialize(DefaultHostOptions 选项,IServiceProvider hostServices) Microsoft.Framework.Runtime.DefaultHost..ctor(DefaultHostOptions 选项,IServiceProvider hostServices) Microsoft.Framework.ApplicationHost.Program.Main(String [] args) ---从抛出异常的先前位置开始的堆栈跟踪结束---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
在 Microsoft.Framework.Runtime.Common.EntryPointExecutor.Execute(大会 assembly,String [] args,IServiceProvider serviceProvider)at dnx.host.Bootstrapper.RunAsync(List`1 args,IRuntimeEnvironment env)
at dnx.host.RuntimeBootstrapper.ExecuteAsync(String [] args)at dnx.host.RuntimeBootstrapper.Execute(String [] args)
答案 0 :(得分:0)
您使用的是什么.net框架?
根据这份文件:
http://blogs.msdn.com/b/adonet/archive/2015/07/20/entity-framework-and-visual-studio-2015-rtm.aspx
面向.NET 4.5.1或更高版本的完整.NET应用程序(控制台,WPF,WinForms和ASP.NET 4)。
尝试升级您的框架版本?