locked
Enable-Migrations Parameter is Incorrect in Nuget Console RRS feed

  • Question

  • User-939035612 posted

    Hi,

    I am trying to populate a database with three fields. UserIf, registration date, and last login date. Seems easy enough so I followed a couple of tutorials that told me to create the database table and the columns before adding a new class to my IdentityModels.cs files in my web forms app. Then they say I must enable migrations for it to work because when I try to create a new users I get an error saying "The model backing the 'ApplicationDbContext' context has changed since the database was created. Consider using Code First Migrations to update the database (http://go.microsoft.com/fwlink/?LinkId=238269)."

    I followed the instructions to enable migrations in Nuget console. Problem is whenever I go to my Nuget console in VS 2019 it says that Enable-Migrations or enable-migrations is an invalid parameter:

    Each package is licensed to you by its owner. NuGet is not responsible for, nor does it grant any licenses to, third-party packages. Some packages may include dependencies which are governed by additional licenses. Follow the package source (feed) URL to determine any dependencies.

    Package Manager Console Host Version 5.1.0.6013

    Type 'get-help NuGet' to see all available NuGet commands.

    PM> Enable-Migrations
    System.ArgumentException: The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))

    Server stack trace:
    at EnvDTE.Properties.Item(Object index)
    at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs)
    at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg)

    Exception rethrown at [0]:
    at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
    at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
    at EnvDTE.Properties.Item(Object index)
    at System.Data.Entity.Migrations.Extensions.ProjectExtensions.GetPropertyValue[T](Project project, String propertyName)
    at System.Data.Entity.Migrations.MigrationsDomainCommand.GetFacade(String configurationTypeName, Boolean useContextWorkingDirectory)
    at System.Data.Entity.Migrations.EnableMigrationsCommand.FindContextToEnable(String contextTypeName)
    at System.Data.Entity.Migrations.EnableMigrationsCommand.<>c__DisplayClass2.<.ctor>b__0()
    at System.Data.Entity.Migrations.MigrationsDomainCommand.Execute(Action command)
    The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))
    PM> enable-migrations
    System.ArgumentException: The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))

    Server stack trace:
    at EnvDTE.Properties.Item(Object index)
    at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs)
    at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg)

    Exception rethrown at [0]:
    at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
    at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
    at EnvDTE.Properties.Item(Object index)
    at System.Data.Entity.Migrations.Extensions.ProjectExtensions.GetPropertyValue[T](Project project, String propertyName)
    at System.Data.Entity.Migrations.MigrationsDomainCommand.GetFacade(String configurationTypeName, Boolean useContextWorkingDirectory)
    at System.Data.Entity.Migrations.EnableMigrationsCommand.FindContextToEnable(String contextTypeName)
    at System.Data.Entity.Migrations.EnableMigrationsCommand.<>c__DisplayClass2.<.ctor>b__0()
    at System.Data.Entity.Migrations.MigrationsDomainCommand.Execute(Action command)
    The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))
    PM>

    Can this be solved faster than just adding SQL to the code behind on my registration and login pages?

    Thursday, August 22, 2019 8:11 PM

All replies