从Package Manager到dnx添加迁移

时间:2022-10-14 02:13:18

I can add a migration from the console using dnx like so:

我可以使用dnx从控制台添加迁移,如下所示:

dnx . ef migration add test

But I can't do it via Visual Studio's Package Manager Console, using the same line above. The error I get is:

但我不能通过Visual Studio的软件包管理器控制台,使用上面的相同行。我得到的错误是:

dnx : System.InvalidOperationException: Failed to resolve the following dependencies for target framework 'DNX,Version=v4.5.1':
At line:1 char:1
+ dnx . ef migration add test
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (System.InvalidO...ersion=v4.5.1'::String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError

   EntityFramework.Commands 7.0.0-beta5
   EntityFramework.SqlServer 7.0.0-beta5
   ...

Is the PMC running for 4.5.1 and the console something else?

PMC是否运行4.5.1,控制台是否运行其他东西?

I would prefer to run the dnx commands from the Package Manager rather than a separate window, as we used to using Add-Migration...

我更喜欢从包管理器而不是单独的窗口运行dnx命令,因为我们以前使用Add-Migration ...

1 个解决方案

#1


1  

The Package Manager Console wasn't in the right directory. I needed to cd src\appname to get into the right folder before running the dnx command.

程序包管理器控制台不在正确的目录中。在运行dnx命令之前,我需要cd src \ appname进入正确的文件夹。

#1


1  

The Package Manager Console wasn't in the right directory. I needed to cd src\appname to get into the right folder before running the dnx command.

程序包管理器控制台不在正确的目录中。在运行dnx命令之前,我需要cd src \ appname进入正确的文件夹。