我们正在从Entity Framework 4切换到Entity Framework 6的过程中。程序包管理器完成了其工作,并且该解决方案可以顺利进行测试。
但是,在构建服务器上,我们得到以下错误消息来运行测试:
初始化方法xxx.SetUp引发异常。 System.InvalidOperationException:
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,则该测试将再次运行而不会出现错误。
我们将Cruise Control .Net与SVN结合使用,作为我们持续集成的工具。 Ms Build用于构建解决方案,并且测试与Ms Test一起运行。
是否有人遇到过类似的问题或对解决方案有何想法?
最佳答案
这真的很烂。但幸运的是,有一个比我更好的程序员,我遇到了同样的问题,并发表了这篇出色的文章:
http://robsneuron.blogspot.nl/2013/11/entity-framework-upgrade-to-6.html
将此行添加到我们的DbContext构造函数中可解决此问题:
var确保DLLIsCopied = System.Data.Entity.SqlServer.SqlProviderServices.Instance;
该变量从不使用,在使用VS进行构建时不需要,它只是在确保Build女士能够完成工作的地方。
关于msbuild - Buildserver找不到 Entity Framework Sql提供程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22478327/