Entity Framework 4.3 Migration Exception when Update-Database
-
Tuesday, February 07, 2012 10:07 AM
After upgrading from EF 4.2 and Migration to EF 4.3 and enabling migration,restarting Visual studio and everything , whenever I try to call Update-Database/Add-Migration I get this:
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentException: The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG)) --- End of inner exception stack trace --- at System.RuntimeType.InvokeDispMethod(String name, BindingFlags invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers, Int32 culture, String[] namedParameters) at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams) at System.Management.Automation.ComMethod.InvokeMethod(PSMethod method, Object[] arguments) Update-Database : Exception has been thrown by the target of an invocation. At line:1 char:1 + update-database + ~~~~~~~~~~~~~~~ + CategoryInfo : OperationStopped: (Exception has b... an invocation.:String) [Update-Database], RuntimeException + FullyQualifiedErrorId : Exception has been thrown by the target of an invocation.,Update-Database
I tried cleaning the whole project , deleting ef and migration and packages folder and doing it from the beginning and still same error !
Anyone facing the same error? Or have a solution for this?
- Moved by Alan_chen Thursday, February 09, 2012 6:43 AM (From:ADO.NET Entity Framework and LINQ to Entities)
All Replies
-
Tuesday, February 07, 2012 5:59 PMDid you restart Visual Studio after upgrading?
Brice Lambson
-
Sunday, February 12, 2012 2:33 PM
Do you have your DbContext in a seperate (class library) project?
I did, and got the same exception.
You need to add -StartUpProjectName "Your Project Name" to the Add-Migration and UpdateDatabase commands.
- Edited by Remco Ros - PROSCAT Sunday, February 12, 2012 2:36 PM

