无法加载文件或程序集' EntityFramework.SqlServer,Version = 6.0.0.0

时间:2015-10-13 10:35:04

标签: c# .net sql-server entity-framework

我的.NET 5.0 Web API项目存在问题,我使用的是Entity Framework 6.1.3。在这个项目中,我需要使用一些.Dll引用的一些旧项目使用Entity framework 6.0.0。我有异常"无法加载文件或程序集' EntityFramework.SqlServer,Version = 6.0.0.0 ......"没有我在所有项目中更新实体框架为版本6.1.3。请帮帮我!

这是Project.json:

{
  "webroot": "wwwroot",
  "version": "1.0.0-*",

  "dependencies": {
  "Microsoft.AspNet.Server.IIS": "1.0.0-beta6",
"Microsoft.AspNet.Server.WebListener": "1.0.0-beta5",
"EntityFramework": "6.1.3",
"EntityFramework.SqlServer": "7.0.0-beta6",
"EntityFramework.Commands": "7.0.0-beta6",
"structuremap": "3.1.6.186",
"Microsoft.AspNet.Mvc": "6.0.0-beta6",
"Microsoft.AspNet.Diagnostics": "1.0.0-beta6",
"Microsoft.Framework.Configuration.Json": "1.0.0-beta5",
"System.ServiceModel.Duplex": "4.0.0-beta-23019",
"System.ServiceModel.NetTcp": "4.0.0-beta-23019",
"System.ServiceModel.Security": "4.0.0-beta-23019"

},

"commands": {
"web": "Microsoft.AspNet.Hosting --config hosting.ini",
"ef": "EntityFramework.Commands"
},

"frameworks": {
"dnx451": {
"dependencies": {
"CuttingEdge.Conditions": "1.0.0-*",
"Quartz": "1.0.0-*",
"Project.Application": "1.0.0-*",
"Project.Finance": "1.0.0-*",
"Project.Infrastructure": "1.0.0-*",
"Project.QuartzScheduler": "1.0.0-*",
"Project.ServiceDesks": "1.0.0-*",
"Project.Utilities": "1.0.0-*",
"Project.WCFMock": "1.0.0-*"
},
"frameworkAssemblies": {
"System.ServiceModel": "4.0.0.0"
}
}
},

"publishExclude": [
"node_modules",
"bower_components",
"**.xproj",
"**.user",
"**.vspscc"
],
"exclude": [
"wwwroot",
"node_modules",
"bower_components"
]
}

我已将旧项目中的实体框架更新为版本6.1.3并在App.config中进行设置:

<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.1.3.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />

但上述异常仍然存在。请帮帮我!

这是完整的错误:

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)

1 个答案:

答案 0 :(得分:0)

您的问题是您正在加载EF6和EF7(.animate中有两个版本)。您应该将if ($('html').scrollTop()) { $('html').animate({ scrollTop: 0 }, callback); return; } 降级为版本6,或将project.json升级到版本7.

换句话说,要么使用EF6,要么使用EF7,但不要混用不同版本的程序集。

EntityFramework.SqlServer