No Entity Framework provider found - calling a C# Com DLL from within VB6

com entity-framework vb6


I want to use EF6 inside a C# Com visible DLL that I use in my VB6 application, but experience an error. Note I am not using app.config , rather I am passing the connection string in from the VB6 program.

Inside the C# code I access the DBContext as follows;

private static MyDataEntities CreateDb()
    return new MyDataEntities(EFConnectionString);

EFConnectionString is

"metadata=res://*/vivModel.csdl|res://*/vivModel.ssdl|res://*/vivModel.msl;provider=System.Data.SqlClient;provider connection string='data source=MYPC\SQL2008R2;initial catalog=MyDatabase;user id=sa;password=mypassword;MultipleActiveResultSets=True;App=EntityFramework'"

The error message is

[[Schema specified is not valid. Errors: vivModel.ssdl(2,2) : error 0152: No Entity Framework provider found for the ADO.NET provider with invariant name 'System.Data.SqlClient'. Make sure the provider is registered in the 'entityFramework' section of the application config file. See for more information.]]

1/7/2014 9:02:29 AM

Accepted Answer

I have been able to get past this error by copying the dlls from the packages folder to the same folder as my vb executable. EntityFramework.sqlserver.dll was not finding its way to bind\debug

1/7/2014 9:03:32 AM

Popular Answer

I had the same error using VS 2013, EF 6.1.1, in a solution with N-tier with two Web Application projects and one class library. I have installed EF just in this class library. I solved the problem when I installed the EF in the Web Application projects too. After that, the EntityFramework.sqlserver.dll was found in the folder bin/debug. I found the solution in another stackoverflow question.

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