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

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

问题描述

我们正在从 Entity Framework 4 切换到 Entity Framework 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' 在应用程序配置文件中注册对于具有不变名称System.Data.SqlClient"的 ADO.NET 提供程序无法加载.确保程序集限定名称是并且该程序集可用于正在运行的应用程序.有关详细信息,请参阅 http://go.microsoft.com/fwlink/?LinkId=260882信息.

The Entity Framework provider type 'System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer' registered in the application config file for the ADO.NET provider with invariant name 'System.Data.SqlClient' could not be loaded. Make sure that the assembly-qualified name is used and that the assembly is available to the running application. See http://go.microsoft.com/fwlink/?LinkId=260882 for more information.

如果我们在构建服务器上本地打开解决方案,并在那里安装了 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-升级到 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天全站免登陆