我有2个项目在我的解决方案,我有一个项目与实体框架核心安装:
在另一个 ASP.NET Web API 项目中,我有这些包:
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Antlr" version="3.5.0.2" targetFramework="net461" />
<package id="Microsoft.ApplicationInsights" version="2.5.1" targetFramework="net461" />
<package id="Microsoft.ApplicationInsights.Agent.Intercept" version="2.4.0" targetFramework="net461" />
<package id="Microsoft.ApplicationInsights.DependencyCollector" version="2.5.1" targetFramework="net461" />
<package id="Microsoft.ApplicationInsights.PerfCounterCollector" version="2.5.1" targetFramework="net461" />
<package id="Microsoft.ApplicationInsights.Web" version="2.5.1" targetFramework="net461" />
<package id="Microsoft.ApplicationInsights.WindowsServer" version="2.5.1" targetFramework="net461" />
<package id="Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel" version="2.5.1" targetFramework="net461" />
<package id="Microsoft.AspNet.Mvc" version="5.2.4" targetFramework="net461" />
<package id="Microsoft.AspNet.Razor" version="3.2.4" targetFramework="net461" />
<package id="Microsoft.AspNet.TelemetryCorrelation" version="1.0.0" targetFramework="net461" />
<package id="Microsoft.AspNet.Web.Optimization" version="1.1.3" targetFramework="net461" />
<package id="Microsoft.AspNet.WebApi" version="5.2.4" targetFramework="net461" />
<package id="Microsoft.AspNet.WebApi.Client" version="5.2.4" targetFramework="net461" />
<package id="Microsoft.AspNet.WebApi.Core" version="5.2.4" targetFramework="net461" />
<package id="Microsoft.AspNet.WebApi.HelpPage" version="5.2.4" targetFramework="net461" />
<package id="Microsoft.AspNet.WebApi.WebHost" version="5.2.4" targetFramework="net461" />
<package id="Microsoft.AspNet.WebPages" version="3.2.4" targetFramework="net461" />
<package id="Microsoft.CodeDom.Providers.DotNetCompilerPlatform" version="2.0.0" targetFramework="net461" />
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net461" />
<package id="Newtonsoft.Json" version="11.0.1" targetFramework="net461" />
<package id="System.Diagnostics.DiagnosticSource" version="4.4.1" targetFramework="net461" />
<package id="WebGrease" version="1.6.0" targetFramework="net461" />
</packages>
当我在 PMC 运行 Add-Migration
时:
您的启动项目“ API”没有引用 此包是 实体框架核心工具工作。确保您的启动项目是 正确,安装软件包,然后再试一次。
我安装了微软。实体框架核心。设计在启动项目,而不是数据项目,将包含所有的实体,现在它的工作,这是项目应该如何设置?