Buildserver找不到Entity Framework Sql Provider [英] Buildserver can not find Entity Framework Sql Provider

查看:266
本文介绍了Buildserver找不到Entity Framework Sql Provider的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在从实体框架4切换到实体框架6.包管理器完成了其工作,解决方案无障碍地运行了测试。

We are in the process of switching from Entity Framework 4 to Entity Framework 6. The package manager did its job, and the solution ran it’s tests without a hitch.

但是在构建服务器上,我们得到以下运行测试的错误消息:
初始化方法xxx.SetUp抛出异常。 System.InvalidOperationException:

However on the build server we get the following error message running the tests: Initialization method xxx.SetUp threw exception. System.InvalidOperationException:


实体框架提供程序类型
'System.Data.Entity.SqlServer.SqlProviderServices,
EntityFramework.SqlServer'注册在应用程序配置文件
为ADO.NET提供程序不变名称'System.Data.SqlClient'
无法加载。确保使用装配限定名称
,并且该程序集可用于正在运行的应用程序。
有关更多信息,请参阅 http://go.microsoft.com/fwlink/?LinkId=260882
信息。

如果我们在构建服务器上本地打开解决方案,并安装了Visual Studio,那么测试运行无需再错误。

If we open the solution locally on the build server, with a Visual Studio installed there, the test run without error again.

我们将Cruise Control .Net与SVN结合使用,作为我们持续集成的工具。 Ms Build用于构建解决方案,测试由Ms Test运行。

We use Cruise Control .Net in combination with SVN as tooling for our continuous integration. Ms Build is used to build the solution and the tests are run with Ms Test.

有没有人遇到类似的问题或对解决方案有任何想法?

Has anybody experienced similar problems or has any thoughts on a solution?

推荐答案

这真的吸引了MS。但幸好一些比我有同样的问题更好的程序员,并做出了这个优秀的职位:
http://robsneuron.blogspot.nl/2013/11/entity-framework-upgrade-to-6.html

This really sucks MS. But fortunately some better programmer than I had the same problem and made this excellent post: http://robsneuron.blogspot.nl/2013/11/entity-framework-upgrade-to-6.html

添加此行对我们的DbContext构造函数修复了问题:

Adding this line to our DbContext constructor fixes the problem:

var ensureDLLIsCopied = System.Data.Entity.SqlServer.SqlProviderServices.Instance;

var ensureDLLIsCopied = System.Data.Entity.SqlServer.SqlProviderServices.Instance;

变量永远不会使用,在使用VS构建时不需要,只有确保Ms Build完成其工作...

The variable is never used, is not needed when using VS to build, it is only there to make sure Ms Build does its job...

这篇关于Buildserver找不到Entity Framework Sql Provider的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆