Enable-Migrations fails

Mar 8, 2013 at 9:49 PM
I've downloaded this project, unzipped it and immediately go to the Package Manager Console and type "Enable-Migrations -EnableAutomaticMigrations" and receive the following:

PM> Enable-Migrations -EnableAutomaticMigrations
System.Runtime.Serialization.SerializationException: Type is not resolved for member 'System.Data.Entity.Migrations.Design.ToolingFacade+GetContextTypeRunner,EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
at System.AppDomain.DoCallBack(CrossAppDomainDelegate callBackDelegate)
at System.Data.Entity.Migrations.Design.ToolingFacade.Run(BaseRunner runner)
at System.Data.Entity.Migrations.Design.ToolingFacade.GetContextType(String contextTypeName)
at System.Data.Entity.Migrations.EnableMigrationsCommand.FindContextToEnable(String contextTypeName)
at System.Data.Entity.Migrations.EnableMigrationsCommand.<>c__DisplayClass2.<.ctor>b__0()
at System.Data.Entity.Migrations.MigrationsDomainCommand.Execute(Action command)
Type is not resolved for member 'System.Data.Entity.Migrations.Design.ToolingFacade+GetContextTypeRunner,EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.

I've looked at these solutions and I believe there is something to them (see below). It's related to switching from .NET 4.0 to .NET 4.5. Some of the app.config settings are still saying 4.4.0 for Entity Framework (the .NET 4.0 way of saying Entity Framework 5) instead of 5.0.0. Also, versions are set to v4.0 instead of v4.5...etc. However, fixing these does not seem to fix the error above.

-references-

http://stackoverflow.com/questions/12021656/enable-migrations-fails-after-upgrading-to-net-4-5-and-ef-5
http://stackoverflow.com/questions/13144827/entity-framework-code-first-migrations-enable-migrations-fails


Has anyone been able to enable migrations with this project? If so, please let me know how.

Thank you,
Michael
Mar 9, 2013 at 12:58 PM
I'll answer my own question so others can hopefully move beyond this issue, sooner.

It was the '&' in my directory path. I had this project and all others in ...\R&D\EFMVC...etc. By simply removing the '&' (I assume for all special characters or non-alphanumeric characters) and it worked. so ...\RD\EFMVC\ now works.

-Michael
Mar 13, 2013 at 6:53 AM
Can you tell me how do you setup the database? I am having a hard time setting it along with the data. Thanks.
Mar 13, 2013 at 7:38 PM
Hi Bl3uman. I'm not sure what you mean by "how do you setup the database". I can tell you that I'm using SQL Server express 2008 R2. It's the regular installation procedure, nothing fancy or extra. The connection string in the web.config for EFMVC worked without any changes, so after running EFMVC and clicking on Categories and adding one, I checked my localhost\SQLEXPRESS and there was a new database already created. I didn't create the database, myself or in anyway do any setup for EFMVC. It was created entirely by Code First.

-Michael
Mar 15, 2013 at 4:43 AM
Thanks Michael. I have SQL 2008R2 in my machine so i changed the connection string to point to the server. When i ran the code it failed saying that it cannot recognize the connection string, moreover i never worked with Migrations. When i clicked catgories it tried to fetch from DB and there it bombed. Do i need to do anything different here?
Mar 17, 2013 at 2:45 AM
Thanks Michael. I have SQL 2008R2 in my machine so i changed the connection string to point to the server. When i ran the code it failed saying that it cannot recognize the connection string, moreover i never worked with Migrations. When i clicked catgories it tried to fetch from DB and there it bombed. Do i need to do anything different here?
Mar 17, 2013 at 12:21 PM
Thanks Michael. I have SQL 2008R2 in my machine so i changed the connection string to point to the server. When i ran the code it failed saying that it cannot recognize the connection string, moreover i never worked with Migrations. When i clicked catgories it tried to fetch from DB and there it bombed. Do i need to do anything different here?