Click here to Skip to main content
15,891,253 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm running through the tutorial @ ASP.Net "Contoso University" and my Package Manager Console does not allow me to "Enable-Migrations".

This is the command I'm typing in:

enable-migrations -ContextTypeName ContosoUniversityModelBinding.Models.SchoolContext

This is the message I'm getting from the Package Manager Console:

The context type 'ContosoUniversityModelBinding.Models.SchoolContext' was not found in the assembly 'ContosoUniversityModelBinding'.

I've followed every instruction in the tutorial. Please help. I cannot find any information on the web about this.
Posted
Comments
Afzaal Ahmad Zeeshan 24-Sep-14 14:46pm    
Did you create that object "SchoolContext" before migrating?
Branden Coker 24-Sep-14 15:14pm    
I created the Model class which houses three classes (Student, Enrollment, Course). After I constructed the class I tried the migration and that is when it failed. I did not however create a SchoolContext as it was not in the tutorial.

I believe this is the complete tutorial and I would imagine they wouldn't skip anything like that being Microsoft but maybe I should run through it again. Thank you for your suggestion. I'll check it out.
Branden Coker 24-Sep-14 15:27pm    
I was just "fine-tooth combing" my code and I did find that I missed typing in the Context. Thank you for your help. I'll know in the future where the error was made and sorry to waste your time.

1 solution

The error in your code, is that you have not created the "SchoolContext" which you are passing as a value to the enable-migrations command. Which is a required one.

Please create one, or if (as you've already mentioned) are following the tutorial, then first atleast try to follow them on the way. And then, create your own framework to work with. The first step however, will be to follow the tutorial. They will explain how the stuff works in the code.
 
Share this answer
 
Comments
Branden Coker 24-Sep-14 15:27pm    
Thank you for your help as well Afzaal.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900