2. File -> New Web Site -> Asp.Net Dynamic Data Enitities For Web Site
(creates a new web site project, in my case WebSite9)
3. Tools->Library Package Manager->Manage NuGet Packages For Solution...
4. Select EntityFrameWork and install for WebSite9.
5. Create class file PeopleDb.cs in App_Code folder containing:
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Web;
public class Person
{
public int PersonId { get; set; }
}
public class PeopleDb : DbContext
{
public DbSet<Person> people { get; set; }
}
6. Change the global.asax file as advised all over the web to contain:
7. Try to enable migrations by typing Enable-Migrations into the Package Manager Console window.
It always give the same error:
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)
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 have tried adding -ContextTypeName PeopleDb, I have tried adding -StartUpProjectName WebSite9.
Which Parameter is incorrect? What is the correct Parameter? Does anybody know what exactly I need to type into the PM Console in order to make the Enable-Migrations functionality work?
This is such a frustrating thing. Such a tiny, tiny thing. Am I doing something wrong? Perhaps Enable-Migrations is not meant to be used in the"For Web" version of Visual Studio. I am lost in a sea of .Net related acronyms and forums and documentation desperately
trying to get the Enable-Migrations command to work.
19/02/2013 Update:
Thanks for the responses, the links were useful to explain a few things. I have no idea how the issue got solved, but suddenly the Enable-Migrations command works for me even though I am doing exactly the same set of things as before. The only difference
is that I have installed the Azure SDK. If anybody else has this issue then I would say to install the 2012 Azure SDK http://www.windowsazure.com/en-us/downloads/ and try again.
mtthwbrnd
0 Points
1 Post
Enable-Migrations does not work. HRESULT: 0x80070057 (E_INVALIDARG)
Feb 18, 2013 04:07 AM|LINK
1. Start Visual Studio Express 2012 for Web
2. File -> New Web Site -> Asp.Net Dynamic Data Enitities For Web Site
(creates a new web site project, in my case WebSite9)
3. Tools->Library Package Manager->Manage NuGet Packages For Solution...
4. Select EntityFrameWork and install for WebSite9.
5. Create class file PeopleDb.cs in App_Code folder containing:
using System; using System.Collections.Generic; using System.Data.Entity; using System.Linq; using System.Web; public class Person { public int PersonId { get; set; } } public class PeopleDb : DbContext { public DbSet<Person> people { get; set; } }6. Change the global.asax file as advised all over the web to contain:
DefaultModel.RegisterContext(() => { return ((System.Data.Entity.Infrastructure.IObjectContextAdapter)new PeopleDb()).ObjectContext; }, new ContextConfiguration() { ScaffoldAllTables = false });7. Try to enable migrations by typing Enable-Migrations into the Package Manager Console window.
It always give the same error:
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)
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 have tried adding -ContextTypeName PeopleDb, I have tried adding -StartUpProjectName WebSite9.
Which Parameter is incorrect? What is the correct Parameter? Does anybody know what exactly I need to type into the PM Console in order to make the Enable-Migrations functionality work?
This is such a frustrating thing. Such a tiny, tiny thing. Am I doing something wrong? Perhaps Enable-Migrations is not meant to be used in the"For Web" version of Visual Studio. I am lost in a sea of .Net related acronyms and forums and documentation desperately trying to get the Enable-Migrations command to work.
19/02/2013 Update:
Thanks for the responses, the links were useful to explain a few things. I have no idea how the issue got solved, but suddenly the Enable-Migrations command works for me even though I am doing exactly the same set of things as before. The only difference is that I have installed the Azure SDK. If anybody else has this issue then I would say to install the 2012 Azure SDK http://www.windowsazure.com/en-us/downloads/ and try again.
Pengzhen Son...
Star
8140 Points
837 Posts
Microsoft
Re: Enable-Migrations does not work. HRESULT: 0x80070057 (E_INVALIDARG)
Feb 19, 2013 01:27 AM|LINK
Hi,
You can try running add-migration command with -StartupProjectName "YourProject" parameter.
For detailed information, you can refer here
http://stackoverflow.com/questions/9582129/exceptions-for-entity-framework-code-first-migrations
http://robertgreiner.com/2012/04/entity-framework-code-first-migrations-target-invocation-exception/
Hope it can help you.
Feedback to us
Develop and promote your apps in Windows Store
ToughMan
Participant
1490 Points
635 Posts
Re: Enable-Migrations does not work. HRESULT: 0x80070057 (E_INVALIDARG)
Feb 19, 2013 03:50 AM|LINK
Lack of parameters, plz see:
http://msdn.microsoft.com/en-us/data/jj591621.aspx
http://coding.abel.nu/2012/03/ef-migrations-command-reference/