尝试在程序包管理器控制台中执行dotnet ef migrations add "initial"
时出现此错误
我尝试使用此post解决问题,但这不起作用
这是我的project.json文件
{
"userSecretsId": "Jobs",
"dependencies": {
"AutoMapper.Data": "1.0.0-beta1",
"FastJobsProject.BLL": "1.0.0-*",
"FastJobsProject.Entity": "1.0.0-*",
"FluentValidation": "6.2.1-beta1",
"Microsoft.AspNetCore.Diagnostics": "1.0.0",
"Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore": "1.0.0",
"Microsoft.AspNetCore.Mvc": "1.0.0",
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.0",
"Microsoft.AspNetCore.StaticFiles": "1.0.0",
"Microsoft.EntityFrameworkCore": "1.1.1",
"Microsoft.EntityFrameworkCore.Design": "1.1.1",
"Microsoft.EntityFrameworkCore.SqlServer": "1.1.1",
"Microsoft.EntityFrameworkCore.SqlServer.Design": "1.1.1",
"Microsoft.EntityFrameworkCore.Tools": {
"version": "1.1.0"
},
"Microsoft.Extensions.Configuration": "1.0.0",
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0",
"Microsoft.Extensions.Configuration.FileExtensions": "1.0.0",
"Microsoft.Extensions.Configuration.Json": "1.0.0",
"Microsoft.Extensions.Configuration.UserSecrets": "1.0.0",
"Microsoft.Extensions.FileProviders.Physical": "1.0.0",
"Microsoft.NETCore.App": {
"version": "1.0.0",
"type": "platform"
},
"Newtonsoft.Json": "9.0.1"
},
"tools": {
"Microsoft.AspNetCore.Server.IISIntegration.Tools": {
"version": "1.0.0-preview2-final",
"imports": "portable-net45+win8+dnxcore50"
},
"Microsoft.EntityFrameworkCore.Tools": {
"imports": [
"portable-net45+win8+dnxcore50",
"portable-net45+win8"
],
"version": "1.0.0-preview2-final"
}
},
"frameworks": {
"netcoreapp1.0": {
"imports": [
"dotnet5.6",
"dnxcore50",
"portable-net45+win8"
]
}
},
"buildOptions": {
"emitEntryPoint": true,
"preserveCompilationContext": true
},
"runtimeOptions": {
"gcConcurrent": true,
"gcServer": true
},
"publishOptions": {
"include": [
"wwwroot",
"web.config"
]
},
"scripts": {
"postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
}
}
任何人都可以向我解释上述错误的含义及解决方法。
由于
答案 0 :(得分:0)
在搜索解决方案并在我的案例中尝试它们之后,我得出结论,依赖版本之间的不兼容性是问题。
{
"userSecretsId": "Jobs",
"dependencies": {
"AutoMapper.Data": "1.0.0-beta1",
"FastJobsProject.BLL": "1.0.0-*",
"FastJobsProject.DAL": "1.0.0-*",
"FastJobsProject.Entity": "1.0.0-*",
"FluentValidation": "6.2.1-beta1",
"Microsoft.AspNetCore.Diagnostics": "1.0.0",
"Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore": "1.0.0",
"Microsoft.AspNetCore.Mvc": "1.0.0",
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.0",
"Microsoft.AspNetCore.StaticFiles": "1.0.0",
"Microsoft.EntityFrameworkCore": "1.1.1",
"Microsoft.EntityFrameworkCore.SqlServer": "1.1.1",
"Microsoft.EntityFrameworkCore.Tools": {
"type": "build",
"version": "1.1.0-preview4-final"
},
"Microsoft.Extensions.Configuration": "1.0.0",
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0",
"Microsoft.Extensions.Configuration.FileExtensions": "1.0.0",
"Microsoft.Extensions.Configuration.Json": "1.0.0",
"Microsoft.Extensions.Configuration.UserSecrets": "1.0.0",
"Microsoft.Extensions.FileProviders.Physical": "1.0.0",
"Microsoft.NETCore.App": {
"version": "1.0.0",
"type": "platform"
},
"Newtonsoft.Json": "9.0.1"
},
"tools": {
"Microsoft.AspNetCore.Server.IISIntegration.Tools": {
"version": "1.0.0-preview2-final",
"imports": "portable-net45+win8+dnxcore50"
},
"Microsoft.EntityFrameworkCore.Tools.DotNet": "1.1.0-preview4"
},
"frameworks": {
"netcoreapp1.0": {
"imports": [
"dotnet5.6",
"dnxcore50",
"portable-net45+win8"
]
}
},
"buildOptions": {
"emitEntryPoint": true,
"preserveCompilationContext": true
},
"runtimeOptions": {
"gcServer": true,
"gcConcurrent": true
},
"publishOptions": {
"include": [
"wwwroot",
"web.config"
]
},
"scripts": {
"postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
}
}
我希望如果有人遇到同样的问题会有所帮助。