无法加载程序集...确保启动项目引用它

Арс*_*али 6 c# xml wpf entity-framework-core entity-framework-core-migrations

有一个包含应用程序上下文的“Data”项目,以及引用数据项目的根项目“TheFarmersMarketApp”。主要项目是用WPF编写的。

Add-Migration "Initial Migration" -Project Data -StartUpProject TheFarmersMarketApp
Run Code Online (Sandbox Code Playgroud)

回报

Could not load assembly 'Data'. Ensure it is referenced by the startup project 'TheFarmersMarketApp'.
Run Code Online (Sandbox Code Playgroud)

此外,我更改了“数据”和“模型”(呃...)项目的“默认项目”字段,并重新启动了我的笔记本电脑,以确保所有必要的服务都已打开。

有一些Visual Studio的截图,如果直观的话更容易理解问题。

PackageManagerConsole + SolutionExplorer + TheFarmersMarket.csproj 窗口

重建+ ErrorList 窗口后的输出。

小智 0

Could not load assembly 'Data'. Ensure it is referenced by the startup project 'TheFarmersMarketApp'.
Run Code Online (Sandbox Code Playgroud)

请确保将Data程序集添加到项目TheFarmersMarketApp中。请确保所有需要引用该项目的项目都直接引用它,只要不会导致循环依赖或其他问题。