【发布时间】:2015-05-20 05:50:25
【问题描述】:
是否可以在预发布的 ASP.net vNext 下运行 EF6? EF7 没有我需要的某些功能,但我想在 .NET Core 中对我的应用程序进行原型设计。
我收到以下错误:
FileLoadException: A strongly-named assembly is required.
(Exception from HRESULT: 0x80131044) Unknown location
FileLoadException: Could not load file or assembly
'EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089' or one of its dependencies.
A strongly-named assembly is required. (Exception from HRESULT: 0x80131044)
我知道 .NET Core 不支持强命名程序集,但据我所知,我在 aspnet50 框架而不是 aspnetcore50 下运行服务器。
我的 project.json 看起来像这样:
{
"webroot": "wwwroot",
"version": "1.0.0-*",
"dependencies": {
"EntityFramework": "6.1.1",
"Microsoft.AspNet.Mvc": "6.0.0-beta3",
/* "Microsoft.AspNet.Mvc.WebApiCompatShim": "6.0.0-beta3", */
"Microsoft.AspNet.Diagnostics": "1.0.0-beta3",
"Microsoft.AspNet.Diagnostics.Entity": "7.0.0-beta3",
"Microsoft.AspNet.Identity.EntityFramework": "3.0.0-beta3",
"Microsoft.AspNet.Security.Cookies": "1.0.0-beta3",
"Microsoft.AspNet.Server.IIS": "1.0.0-beta3",
"Microsoft.AspNet.Server.WebListener": "1.0.0-beta3",
"Microsoft.AspNet.StaticFiles": "1.0.0-beta3",
"Microsoft.Framework.ConfigurationModel.Json": "1.0.0-beta3",
"Microsoft.Framework.CodeGenerators.Mvc": "1.0.0-beta3",
"Microsoft.Framework.Logging": "1.0.0-beta3",
"Microsoft.Framework.Logging.Console": "1.0.0-beta3",
"Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0-beta3",
"Tricycle.SqlPlatform.EntityFramework": "1.0.0-*"
},
"commands": {
/* Change the port number when you are self hosting this application */
"web": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.WebListener --server.urls http://localhost:5000",
"gen": "Microsoft.Framework.CodeGeneration",
},
"frameworks": {
"aspnet50": {
"dependencies": {
"Tricycle.Studio.ContentManager.Client": "1.0.0-*"
}
},
//"aspnetcore50": { }
},
"exclude": [
"wwwroot",
"node_modules",
"bower_components"
],
"bundleExclude": [
"node_modules",
"bower_components",
"**.kproj",
"**.user",
"**.vspscc"
],
"scripts": {
"postrestore": [ "npm install" ],
"prepare": [ "grunt bower:install" ]
}
}
EF 类是在一个单独的项目 (Tricycle.Studio.ContentManager.Client) 中使用以下 project.json 定义的:
{
"version": "1.0.0-*",
"dependencies": {
"EntityFramework": "6.1.1",
},
"frameworks": {
"aspnet50": {
"dependencies": {
"System.Data.Common": "1.0.0-beta2",
"System.Data.SqlClient": "1.0.0-beta2"
}
},
//"aspnetcore50" : {
// "dependencies": {
// "System.Runtime": "4.0.20-beta-22523"
// }
//}
}
}
【问题讨论】:
标签: asp.net entity-framework asp.net-core