【发布时间】:2018-06-12 15:26:20
【问题描述】:
我有一个带有目标的 asp.net 核心项目“Api”:
<TargetFramework>net471</TargetFramework>
该项目引用另一个类库项目“Repository”,目标为:
<TargetFramework>netstandard1.4</TargetFramework>
“Api”项目已配置:
services
.AddEntityFrameworkSqlServer()
.AddDbContext<ApplicationDbContext>(options =>
options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection"),
b => b.MigrationsAssembly("Repository"))
)
.AddScoped(p => new ApplicationDbContext(p.GetService<DbContextOptions<ApplicationDbContext>>()));
当我在 PMConsole 中时,我输入:
添加-迁移初始
然后我得到这个错误:
Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[0]
add-migration : Exception calling "Substring" with "1" argument(s): "StartIndex cannot be less than zero.
Parameter name: startIndex"
At line:1 char:1
+ add-migration
+ ~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Add-Migration], MethodInvocationException
+ FullyQualifiedErrorId : ArgumentOutOfRangeException,Add-Migration
我做错了什么?
【问题讨论】:
标签: entity-framework-core asp.net-core-2.0 entity-framework-migrations