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.
However on the build server we get the following error message running the tests: Initialization method xxx.SetUp threw exception. 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.
If we open the solution locally on the build server, with a Visual Studio installed there, the test run without error again.
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?
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
Adding this line to our DbContext constructor fixes the problem:
var ensureDLLIsCopied = System.Data.Entity.SqlServer.SqlProviderServices.Instance;
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...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With