【发布时间】:2017-02-17 17:52:57
【问题描述】:
我有一个项目,它是一个 .NET Core 控制台应用程序,只有一个模型和一些种子数据。在开发桌面上,我可以进入应用程序目录,运行dotnet ef database update,一切正常(我需要将appsettings.json 复制到bin\... 目录,但是可以)。
问题是当我需要在客户端环境中运行它时(通过 VPN 访问,并且没有 Visual Studio)。首先,我不确定我需要将什么复制到远程机器上。但是,假设我复制了整个项目。首先,当我运行时,我收到以下错误:
未处理的异常:System.IO.DirectoryNotFoundException:找不到路径“.nuget\packages.tools\Microsoft.EntityFrameworkCore.Tools”的一部分。
我有一个目录 .nuget\packages\Microsoft.EntityFrameworkCore.Tools 但不在.tools 下。出于绝望,我创建了 .tools 并在其下复制了这个目录,但现在我收到以下异常:
未处理的异常:System.NullReferenceException:对象引用未设置为对象的实例。
在 Microsoft.DotNet.Cli.Utils.ProjectToolsCommandResolver。 ResolveCommandSpecFromToolLibrary(LibraryRange toolLibraryRange, String commandName, IEnumerable`1 args, ProjectContext projectContext)
在 Microsoft.DotNet.Cli.Utils.ProjectToolsCommandResolver。 ResolveCommandSpecFromAllToolLibraries(IEnumerable`1 toolsLibraries, String commandName, IEnumerable`1 args, ProjectContext projectContext)
在 Microsoft.DotNet.Cli.Utils.ProjectToolsCommandResolver。 ResolveFromProjectTools(String commandName, IEnumerable`1 args, String projectDirectory)
在 Microsoft.DotNet.Cli.Utils.ProjectToolsCommandResolver.Resolve (CommandResolverArguments commandResolverArguments)
在 Microsoft.DotNet.Cli.Utils.CompositeCommandResolver.Resolve (CommandResolverArguments commandResolverArguments)
在 Microsoft.DotNet.Cli.Utils.CommandResolver.TryResolveCommandSpec(String commandName, IEnumerable`1 args, NuGetFramework framework, String configuration, String outputPath)
在 Microsoft.DotNet.Cli.Utils.Command.Create(String commandName, IEnumerable`1 args, NuGetFramework framework, String configuration, String outputPath)
在 Microsoft.DotNet.Cli.Program.ProcessArgs(String[] args, ITelemetry telemetryClient)
在 Microsoft.DotNet.Cli.Program.Main(String[] args)
显然,我的反复试验试图找到正确的方法碰壁了。是否有一些关于如何在 Visual Studio 之外运行 EF Core 命令的实质性(不仅仅是语法)文档?如果重要的话,.NET 是 1.1 版
【问题讨论】:
-
请发布您的
project.json或.csproj。 -
您使用的是什么版本的 EF?您使用的是基于 project.json 还是 csproj 的解决方案?
-
EF Core 1.1。项目.json。我的错误是我没有运行
dotnet restore(请参阅下面的评论)
标签: asp.net-core entity-framework-core