none
Error while running Enable-Migrations in Visual studio 2017 RRS feed

  • Question

  • I am trying to migrate my web app from membership to ASP.Net Identity by following this tutorial. But I get this error when I execute the Enable-migrations command:

    PM> Enable-migrations
    System.ArgumentException: Paramètre incorrect. (Exception de HRESULT : 0x80070057 (E_INVALIDARG))
    
    Server stack trace: 
       à EnvDTE.Properties.Item(Object index)
       à System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs)
       à System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg)
    
    Exception rethrown at [0]: 
       à System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
       à System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
       à EnvDTE.Properties.Item(Object index)
       à System.Data.Entity.Migrations.Extensions.ProjectExtensions.GetPropertyValue[T](Project project, String propertyName)
       à System.Data.Entity.Migrations.MigrationsDomainCommand.GetFacade(String configurationTypeName, Boolean useContextWorkingDirectory)
       à System.Data.Entity.Migrations.EnableMigrationsCommand.FindContextToEnable(String contextTypeName)
       à System.Data.Entity.Migrations.EnableMigrationsCommand.<>c__DisplayClass2.<.ctor>b__0()
       à System.Data.Entity.Migrations.MigrationsDomainCommand.Execute(Action command)
    Paramètre incorrect. (Exception de HRESULT : 0x80070057 (E_INVALIDARG))

    I tried with the parameters -ProjectName and -StartUpProjectName but it does not work. I use EntityFramework 6.2.0. Need help please.

    Wednesday, October 24, 2018 5:23 PM

Answers

  • For those who are interested, I finally created a library a c# in my project (select your project then file-> new project-> visual c# -> class library). I made the migrations in this library and I added it as a reference to my project and it worked.
    • Marked as answer by kstMan Monday, November 5, 2018 7:34 PM
    Monday, November 5, 2018 7:34 PM

All replies

  • Hi kstMan,

    If you use visual studio 2017, please change connection string like below and check if it works for you.

    Data Source=(localdb)\MSSQLLocalDB;Integrated Security=true;
    AttachDbFileName= |DataDirectory|\aspnetdb.mdf; 

    Best regards,

    Zhanglong


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, October 25, 2018 8:52 AM
  • Hello Zhanglong,

    Thank you for your your reply. I didn't start with an empty project. So, in the connection string, I already have informations from my server which is not .\SQLExpress. But I still tried and it doesn't work.

    Thursday, October 25, 2018 8:09 PM
  • Hi kstMan,

    Since it is a asp.net security issue, I would suggest that you could post your issue on asp.net forum for suitable support.

    https://forums.asp.net/25.aspx/1?Security

    Best regards,

    Zhanglong


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, October 26, 2018 8:42 AM
  • For those who are interested, I finally created a library a c# in my project (select your project then file-> new project-> visual c# -> class library). I made the migrations in this library and I added it as a reference to my project and it worked.
    • Marked as answer by kstMan Monday, November 5, 2018 7:34 PM
    Monday, November 5, 2018 7:34 PM