Web Analytics Made Easy -
StatCounter Trying to use migrations with my asp website and its table aspnetusers - CodingForum


No announcement yet.

Trying to use migrations with my asp website and its table aspnetusers

  • Filter
  • Time
  • Show
Clear All
new posts

  • Trying to use migrations with my asp website and its table aspnetusers

    Hello All. I have been working on getting code first migrations working for my asp webpage working for many weeks with lots of frustration. The main reason why i want to use migrations is to add a new column company or something else to my asp websites main login using the db table aspnetusers. There are two similar approaches that i am working on that i have found on the internet. One is this which i have got partially working but its not what i am really looking for.
    The last tutorial asks me to make a class library then use enable-migrations -projectname BooksData in the package manager. This does work but I don't want to store my migrations in a separate class library.
    The next method is half way down this page
    This method is way simpler you just use Enable-Migrations. This is supposed to
    • Open the Package manager console (PMC) and enter Enable-Migrations
    • This will create a Migrations folder and a Configuration.cs file.
    The problem is when i do this my package manager says this when i type enable migrations
    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))
    I am thinking that i need to add the project name to the end of enable migrations but i don't know what format to do for a my website.
    Has anyone been here and done this before please help.
    Last edited by VIPStephan; Mar 9, 2020, 04:16 AM. Reason: added code BB tags for better formatting

  • #2

    I think this is a deceptive error, you get this when trying to perform the enable-migrations on a website, this needs to be performed on a web application

    I have created a library a c# in my project (select your project then file-> new project-> visual c# -> class library).

    I have made the migrations in this library and I have added it as a reference in my project and it works very well
    Last edited by Ishan Shah; Sep 15, 2020, 11:54 PM.
    ASP.Net Software Development