且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

支架-DbContext抛出错误“找不到组件”。在.net核心中

更新时间:2023-11-15 20:33:16

不确定这是否是一个错误,但是 scaffold-dbcontext 命令在启动项目中寻找程序集。

Not sure if this is a bug, but scaffold-dbcontext command looks for the assembly in startup project.

此问题有两种解决方法


  1. 右键单击要在其上运行此命令的项目(您的情况是MyProject.Data),然后选择设为启动项目

  2. 您可以将开关添加到脚手架-DBContext 命令在运行命令时将特定项目设置为启动项目。
    这是您需要在命令末尾添加的内容...

  1. Right click on the project you intend to run this command on (in your case, it is MyProject.Data) and select Set as startup project.
  2. You can add a switch to scaffold-DBContext command to set a particular project as startup project while running the command. This is what you need to add at the end of command...

-StartupProject MyProject.Data