Search code examples
tfsvisual-studio-2015entity-framework-6

Coded UI in Release definition (TFS) error with entity framework


When I run in local my test "coded UI" from visual studio 2015 enterprise they work correctly, but when I run them from a "release definition" (TFS Version 15.117.26714.0) I get this error:

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.

I do not understand it because I have reviewed the entity framework DLLs and they are in the Build:

  • EntityFramework.dll

  • Oracle.ManagedDataAccess.dll

  • Oracle.ManagedDataAccess.EntityFramework.dll

In local works fine, it only happens in the release definition when you run them on a windows 2012 server.

If the "Coded UI" test does not go to database and therefore has no referenced "Entity Framework" it works correctly in the release definition.


Solution

  • Please try below items to narrow down the issue:

    • Make sure you have installed the Vistual Studio on the build/test machine.
    • Check your release definition, make sure your have added the Nuget Installer step to restore the packages.
    • Uninstall Entity Framework nuget and just reinstall.
    • Check if the EntityFramework.SqlServer.dll was missing for any referenced project. If it is, just add the nuget package to that project.
    • Try installing the latest EntityFramework through Nuget for your projects, then try it again.

    Reference this similar thread : How do I solve The Entity Framework provider exception