Buildserver can not find Entity Framework Sql Provider entity-framework-6 msbuild mstest


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 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?

3/18/2014 1:20:40 PM

Accepted Answer

This really sucks MS. But fortunately some better programmer than I had the same problem and made this excellent post:

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...

3/19/2014 11:14:39 AM

Related Questions


Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow