5 Temmuz 2012 Perşembe

error during migration (update-database, codefirst)

I got the following error when i run Update-Database command in Package Manager Console of Visual Studio:


PM> update-database
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.


The solution is specifying the startup project (http://stackoverflow.com/questions/9174116/entity-framework-4-3-migration-exception-when-update-database):


Update-Database –ProjectName "MyInnerProject" –Force -ConnectionString "Data Source=.;Initial Catalog=initialcatalogname;Persist Security Info=True;User ID=userid;Password=password" -ConnectionProviderName "System.Data.SqlClient" -verbose -StartupProjectName "MyStartupProject"

Hiç yorum yok:

Yorum Gönder