Open the MVC Project today (Code-first) and plan to update the database manually, so do this directly in the Package management console:
Enable-migrations-contexttypename bjylonlineserv.areas.enterprise.dal.enterprisecontext-migrationsdirectory Migrations\enterprise;
Console directly gave me a mistake like this, I am surprised, before the good ah, what happened. Error:
Pm> Enable-migrations-contexttypename BJYLOnlineServ.Areas.Enterprise.DAL.EnterpriseContext-migrationsdirectory migrations\enterprise use " 2 "parameter called" SetData ":" Assembly " Microsoft.VisualStudio.TeamArchitect.ModelingProject, version=12.0.0.0, Culture=neutral, publickeytoken= b03f5f7f11d50a3a "type" Microsoft.VisualStudio.TeamArchitect.ModelingProject.ModelProjectAutomationObject " is not marked as serializable. "Location D:\DOCUEMTN-XF\03WORK\ONLINESERVICE_CURR\TRUNK\PACKAGES\ENTITYFRAMEWORK.6.1.3\TOOLS\ENTITYFRAMEWORK.PSM1 : 720 character (s): 20+ $domain. SetData <<<< (' Startupproject ', $startUpProject) + categoryinfo:notspecified: (:) [], methodinvocationexception + fullyqualifiederrorid:dotnetmethodexception System.NullReferenceException: Object reference not set to an instance of an object. In System.Data.Entity.Migrations.Extensions.ProjectExtensions.GetProjectTypes (Project project, Int32 Shellversion) in System.Data.Entity.Migrations.Extensions.ProjectExtensions.IsWebProject (Project Project) in System.Data.Entity.Migrations.MigrationsDomainCommand.GetFacade (String configurationtypename, Boolean Usecontextworkingdirectory) in System.Data.Entity.Migrations.EnableMigrationsCommand.FindContextToEnable (String ContextTypeName) in System.Data.Entity.Migrations.EnableMigrationsCommand.<>c__DisplayClass2.<.ctor>b__0 () does not set an object reference to an instance of an object in System.Data.Entity.Migrations.MigrationsDomainCommand.Execute (Action command).
So ah, I find the reason ah, I find AH find, and really found.
Original: Because I previously set up another project for the startup project, rather than the command in the Bjylonlineserv this project, so I reported this error ... Flow Han Ah ... , we must pay attention to it later!
So write down, to facilitate their own inspection, but also to those who may encounter this problem, to provide a solution, hehe!
When executing enable-migrations, an exception occurred when calling "SetData" using the 2 parameter: "Assembly" Microsoft.VisualStudio.TeamArchitect.ModelingProject,.. "