asp.net - 在 Visual Studio 2017 中运行 Enable-Migrations 时出错
问题描述
我正在尝试按照本教程将我的 Web 应用程序从会员身份迁移到 ASP.Net 身份。但是当我执行 Enable-migrations 命令时出现此错误:
Blockquote PM> Enable-migrations System.ArgumentException: Paramètre 不正确。(HRESULT 异常:0x80070057 (E_INVALIDARG))
服务器堆栈跟踪: à 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 消息)
[0] 处重新抛出异常:à System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) à System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)à EnvDTE.Properties。项目(对象索引)à System.Data.Entity.Migrations.Extensions.ProjectExtensions.GetPropertyValue[T](项目项目,字符串 propertyName)à System.Data.Entity.Migrations.MigrationsDomainCommand.GetFacade(字符串 configurationTypeName,布尔 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命令)参数不正确。(HRESULT 异常:0x80070057 (E_INVALIDARG))
我尝试使用参数 -ProjectName 和 -StartUpProjectName 但它不起作用。我使用 EntityFramework 6.2.0。请需要帮助。
解决方案
对于那些有兴趣的人,我终于在我的项目中创建了一个库 ac#(选择你的项目然后文件-> 新项目-> 可视化 c#-> 类库)。我在这个库中进行了迁移,并将其添加为对我的项目的引用,并且它有效。
推荐阅读
- javascript - 类切换后,如何使此效果永久保留在用户浏览器上?
- sql - PostgreSQL Hstore 字段 - 键包含字符串
- react-native - 使用 react-native-image-picker 将图像上传到服务器出错
- python - 通过用户输入的函数对列表进行排序
- javascript - ReactJS中如何根据类别和子类别组织一个列表?
- wordpress - Wordpress Astra 中的空间未在某些计算机上显示
- javascript - 未捕获的引用错误:未定义 Jquery
- api - 从 Salesforce Commerce Cloud 控制器使用 API
- javascript - 属性名称javascript的数组值
- sql - 需要 SQL 查询以根据字母差异找到最佳答案