简体   繁体   English

启用迁移无效

[英]Enable Migrations doesn't work

I'm trying to add asp.net identity to my Web API, I typed in the package manager console : 我试图在我的Web API中添加asp.net身份,这是我在package manager console输入的:

PM> Enable-Migrations

But I got this error: 但是我得到了这个错误:

Cannot determine a valid start-up project. 无法确定有效的启动项目。 Using project 'MySite.API' instead. 而是使用项目“ MySite.API”。 Your configuration file and working directory may not be set as expected. 您的配置文件和工作目录可能未按预期设置。 Use the -StartUpProjectName parameter to set one explicitly. 使用-StartUpProjectName参数可以显式设置一个。 Use the -Verbose switch for more information. 使用-Verbose开关以获取更多信息。

No context type was found in the assembly 'MySite.API'. 在程序集“ MySite.API”中找不到上下文类型。

I made sure that the Web API project is the default project and the one that is selected on the dropdown. 我确保Web API项目是默认项目,并且是在下拉列表中选择的项目。

this is my packages.Config : 这是我的packages.Config

<packages>
  <package id="Antlr" version="3.4.1.9004" targetFramework="net45" />
  <package id="bootstrap" version="3.0.0" targetFramework="net45" />
  <package id="EntityFramework" version="6.1.3" targetFramework="net45" />
  <package id="jQuery" version="1.10.2" targetFramework="net45" />
  <package id="jQuery.Validation" version="1.11.1" targetFramework="net45" />
  <package id="Microsoft.AspNet.Identity.Core" version="2.2.1" targetFramework="net45" />
  <package id="Microsoft.AspNet.Identity.EntityFramework" version="2.2.1" targetFramework="net45" />
  <package id="Microsoft.AspNet.Identity.Owin" version="2.2.1" targetFramework="net45" />
  <package id="Microsoft.AspNet.Mvc" version="5.2.3" targetFramework="net45" />
  <package id="Microsoft.AspNet.Razor" version="3.2.3" targetFramework="net45" />
  <package id="Microsoft.AspNet.Web.Optimization" version="1.1.3" targetFramework="net45" />
  <package id="Microsoft.AspNet.WebApi" version="5.2.3" targetFramework="net45" />
  <package id="Microsoft.AspNet.WebApi.Client" version="5.2.3" targetFramework="net45" />
  <package id="Microsoft.AspNet.WebApi.Core" version="5.2.3" targetFramework="net45" />
  <package id="Microsoft.AspNet.WebApi.Owin" version="5.2.3" targetFramework="net45" />
  <package id="Microsoft.AspNet.WebApi.WebHost" version="5.2.3" targetFramework="net45" />
  <package id="Microsoft.AspNet.WebPages" version="3.2.3" targetFramework="net45" />
  <package id="Microsoft.jQuery.Unobtrusive.Validation" version="3.2.3" targetFramework="net45" />
  <package id="Microsoft.Owin" version="2.1.0" targetFramework="net45" />
  <package id="Microsoft.Owin.Security" version="2.1.0" targetFramework="net45" />
  <package id="Microsoft.Owin.Security.Cookies" version="2.1.0" targetFramework="net45" />
  <package id="Microsoft.Owin.Security.OAuth" version="2.1.0" targetFramework="net45" />
  <package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net45" />
  <package id="Modernizr" version="2.6.2" targetFramework="net45" />
  <package id="Newtonsoft.Json" version="6.0.4" targetFramework="net45" />
  <package id="Owin" version="1.0" targetFramework="net45" />
  <package id="WebGrease" version="1.5.2" targetFramework="net45" />
</packages>

Any idea what can causes that? 知道是什么原因导致的吗?

在程序包管理器控制台中运行Enable-Migrations命令

Enable-Migrations -ProjectName <String> -StartUpProjectName <String> -Verbose

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM