Skip to content

Instantly share code, notes, and snippets.

@robertgreiner
Created April 19, 2012 15:31
Show Gist options
  • Save robertgreiner/2421752 to your computer and use it in GitHub Desktop.
Save robertgreiner/2421752 to your computer and use it in GitHub Desktop.
How to fix the TargetInvocationException with EntityFramework Code First Migrations
PM> Add-Migration BlogCreated
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)
Exception has been thrown by the target of an invocation.
PM> Add-Migration BlogCreated -StartupProjectName "Blog.Infrastructure"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment