.net core执行dotnet ef migrations add createmodel等命令出错

在执行dotnet ef migrations createmodel、add initial等命令时遇到"No project was found"错误。尝试通过改变工作目录或使用--project选项解决,但问题依旧。最终在必应搜索找到解决方案:一种是明确指定项目路径,另一种是切换到项目目录下再执行命令,第二种方法成功解决问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

.net core执行dotnet ef migrations createmodel等命令出错

  执行dotnet ef migrations createmodel、dotnet ef migrations add initial等命令出错,报错信息为:No project was found. Change the current working directory or use the --project option.命令出错。个人百度.net core、dotnet ef migrations createmodel、dotnet ef migrations add initial、No project was found. Change the current working directory or use the --project option关键字都未发现这个问题的解决办法,最后使用必应国内版,搜索No project was found. Change the current working directory or use the --project option.关键字,得到了解决办法。

  第一种:dotnet ef migrations add InitialCreate --project="C:\path_to_my_project\MyProject.csproj"   使用这样的命令操作,在我写的代码没有作用,依然报出之前的问题;

  第二种:PM> cd "D:{path_to_your_projet}"  PM> dotnet ef migrations add initial 使用第二种方法解决了,不可以使用dotnet ef migrations createmodel、dotnet ef migrations add initial命令的问题。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值