900字范文,内容丰富有趣,生活中的好帮手!
900字范文 > NetCore EF 使用scaffold-dbcontext导致deps.json] does not exist的解决办法

NetCore EF 使用scaffold-dbcontext导致deps.json] does not exist的解决办法

时间:2021-04-27 15:55:25

相关推荐

NetCore EF 使用scaffold-dbcontext导致deps.json] does not exist的解决办法

出现这个问题原因很多,首先要确认是否是因为EF查找路径和生成路径不同导致的。本解决方案只针对这种情况。比如,执行scaffold-dbcontext命令后会提示The specified deps.json [C:\Users\zm\source\repos\Northwind.UI.WPF\Northwind.Data\Northwind.Data.deps.json] does not exist的错误。但是dll并不在这个路径下。那就修改dll生成路径即可,.net5生成的路径模式是:

$(BaseOutputPath)\$(PlatformName)\$(Configuration)\$(RuntimeIdentifier)\$(TargetFramework.ToLowerInvariant())\

EF是在项目的根目录下查找******.deps.json,但是生成DLL默认的项目在根目录下的tagetFramework目录下,比如m:\build\Dispatcher\Debug\netcoreapp1.0,可以修改生成的目录在根目录下

在项目.csproj中增加:

<PropertyGroup><AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath><AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath></PropertyGroup>

然后修改生成目录为根目录

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。