I had the same problem too.
What happens is that EntityFramework.SqlServer.dll does not refer directly to your project, but inside EntityFramework.dll .
Since none of these EntityFramework.SqlServer.dll are used in our code, the Roslyn compiler, using some optimizations, understands that it does not need this component and then does not copy it to the bin folder and also does not copy it for Publish .
What you need to do is create a link to some object of this EntityFramework.SqlServer.dll anywhere in your code.
For example, I have a dependency injection container configuration class, where I configure my repositories and contexts, and I think that would be a good place. Therefore, I created a static property that I never use in any place, but it solves the problem:
using System.Data.Entity.SqlServer; public class ContainerConfiguration {
source share