johnostler 0 Newbie Poster

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.

https://www.mikesdotnetting.com/article/217/code-first-migrations-with-asp-net-web-pages-sites

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

https://forums.asp.net/t/2144249.aspx?Asp+net+identity+with+WebForms+how+to+add+properties+in+users

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.<>cDisplayClass2.<.ctor>b0()
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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.