我在Windows 10预览版中运行带有EF 7 beta 5的ASP.NET 5默认项目模板。在Visual Studio中,项目构建很好,没有任何错误。
使用dnx运行EF迁移时,会出现此错误。
编辑:似乎只是单独运行dnx . ef
会产生同样的错误。
J:\vsproj\AspNet.EF7>dnx . ef migration add Intial
System.InvalidOperationException: Failed to resolve the following dependencies for target framework 'DNX,Version=v4.5.1':
EntityFramework.Commands 7.0.0-beta5
EntityFramework.SqlServer 7.0.0-beta5
Microsoft.AspNet.Authentication.Cookies 1.0.0-beta5
Microsoft.AspNet.Authentication.Facebook 1.0.0-beta5
Microsoft.AspNet.Authentication.Google 1.0.0-beta5
Microsoft.AspNet.Authentication.MicrosoftAccount 1.0.0-beta5
Microsoft.AspNet.Authentication.Twitter 1.0.0-beta5
Microsoft.AspNet.Diagnostics 1.0.0-beta5
Microsoft.AspNet.Diagnostics.Entity 7.0.0-beta5
Microsoft.AspNet.Identity.EntityFramework 3.0.0-beta5
Microsoft.AspNet.Mvc 6.0.0-beta5
Microsoft.AspNet.Mvc.TagHelpers 6.0.0-beta5
Microsoft.AspNet.Server.IIS 1.0.0-beta5
Microsoft.AspNet.Server.WebListener 1.0.0-beta5
Microsoft.AspNet.StaticFiles 1.0.0-beta5
Microsoft.AspNet.Tooling.Razor 1.0.0-beta5
Microsoft.Framework.Configuration.Abstractions 1.0.0-beta5
Microsoft.Framework.Configuration.Json 1.0.0-beta5
Microsoft.Framework.Configuration.UserSecrets 1.0.0-beta5
Microsoft.Framework.Logging 1.0.0-beta5
Microsoft.Framework.Logging.Console 1.0.0-beta5
Microsoft.VisualStudio.Web.BrowserLink.Loader 14.0.0-beta5
Searched Locations:
J:\vsproj\{name}\project.json
J:\vsproj\AspNet.EF7\src\{name}\project.json
J:\vsproj\AspNet.EF7\test\{name}\project.json
C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.1\{name}.dll
C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.1\Facades\{name}.dll
C:\WINDOWS\Microsoft.NET\assembly\GAC_32\{name}\{version}\{name}.dll
C:\WINDOWS\Microsoft.NET\assembly\GAC_64\{name}\{version}\{name}.dll
C:\WINDOWS\Microsoft.NET\assembly\GAC_MSIL\{name}\{version}\{name}.dll
Try running 'dnu restore'.
at Microsoft.Framework.Runtime.DefaultHost.GetEntryPoint(String applicationName)
at Microsoft.Framework.ApplicationHost.Program.ExecuteMain(DefaultHost host, String applicationName, String[] args)
at Microsoft.Framework.ApplicationHost.Program.Main(String[] args)
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.Framework.Runtime.Common.EntryPointExecutor.Execute(Assembly 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)
dun restore命令正常运行,没有任何错误。
J:\vsproj\AspNet.EF7>dnvm list
Active Version Runtime Architecture Location Alias
------ ------- ------- ------------ -------- -----
1.0.0-beta5 clr x64 C:\Users\krishna\.dnx\runtimes
* 1.0.0-beta5 clr x86 C:\Users\krishna\.dnx\runtimes default
1.0.0-beta5 coreclr x64 C:\Users\krishna\.dnx\runtimes
1.0.0-beta5 coreclr x86 C:\Users\krishna\.dnx\runtimes
感谢您的帮助。
答案 0 :(得分:4)
使用迁移将目录从解决方案文件夹更改为项目文件夹,然后运行ef命令。
我认为你将是J:\ vsproj \ AspNet.EF7 \ src \ AspNet.EF7。