I am using ContosoUniversity example. I have just used Nuget to download and install code first migrations pakage. Whe I excecute
update-database command it throws an error . Is there anything to do more than installing nuget package?
Update-Database : Could not load type 'System.Data.Entity.Infrastructure.DbContextInfo' from assembly 'EntityFramework, Version=184.108.40.206, Culture=neutral, PublicKeyToken=b77a5c561934e089'. At line:1 char:16 + update-database <<<< + CategoryInfo : NotSpecified: (:) [Update-Database], TypeLoadException + FullyQualifiedErrorId : System.TypeLoadException,System.Data.Entity.Migrations.Commands.MigrateCommand
Now I have installed
ADO.NET Entity Framework 4.1 - Update 1 and now it throws an error
Update-Database : The project 'ContosoUniversity' does not contain or reference any contexts. At line:1 char:16 + update-database <<<< + CategoryInfo : NotSpecified: (:) [Update-Database], InvalidOperationException + FullyQualifiedErrorId : System.InvalidOperationException,System.Data.Entity.Migrations.Commands.MigrateCommand
I have tried the scenario in microsoft blog but nothing changed. ( http://blogs.msdn.com/b/adonet/archive/2011/07/27/code-first-migrations-august-2011-ctp-released.aspx )
Try installing the msi.
The second error that you are getting sounds like it s having problems identifying a context within your project. Make sure that you have a class that inherits from DbContext.
I would also check that your project is referencing the correct version of the Entity Framework - 4.1 Update 1. Depending on the project type, you should be able to locate the reference in question within the References folder within your project. You may need to click on the 'Show All Files' button (second from the left in the toolbar at the top of the Solution Explorer).
Once you have the reference selected, you will see information such as the path of the DLL and its version in the Properties pane (F4 if it is not already visible).
Edit: According to JTew below, a restart of Visual Studio is required.