efcore Add-Migration 错误

题1:Add-Migration : 使用“1”个参数调用“AddFromFile”时发生异常:““basePath”不能为空字符串("")或以 null 字符开头。

参数名: basePath”
所在位置 行:1 字符: 1
+ Add-Migration "log"
+ ~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Add-Migration], MethodInvocationException
    + FullyQualifiedErrorId : ArgumentException,Add-Migration

1.安装.netCore

2.关闭控制台,重启VS

3.检查空格:多空格或者少空格 偶尔会有这个问题。

问题2:无法将“Add-Migration”项识别为 cmdlet、函数、脚本文件或可运行程序的名称。请检查名称的拼写,如果包括路径,请确保路径正确,然后再试一次。

1.引用 EFCore.sql、EFCore、EFCore.Design.

https://www.cnblogs.com/enigmaxp/p/9159391.html

问题3:No migrations configuration type was found in the assembly 'Nop.Data'. (In Visual Studio you can use the Enable-Migrations command from Package Manager Console to add a migrations configuration). 

1.执行  Enable-Migrations –EnableAutomaticMigrations

常用命令:

add-Migration -c TextContext  initDb

update-Database -c TextContext 

原文地址:https://www.cnblogs.com/yexiaoyanzi/p/9590105.html