No Entity Framework provider found for the ADO.NET provider with invariant name ‘System.Data.SqlClient’

This was the message I was getting while trying to run a unit test against my C# project:

No Entity Framework provider found for the ADO.NET provider with invariant name ‘System.Data.SqlClient’

Not pleasant. My web project did have Entity Framework 6.x installed, so what was going on?

The issue wasn’t with my web project, it was with my test project. I needed to have those Entity Framework DLLs in my test project as well. I took the easy way out and installed them via NuGet Console. At the prompt, I entered this:

Install-Package EntityFramework

 

Voila, that was all I needed. But just make sure that when the NuGet Console is open, you change the “Default project” drop down list to point to your test project, not the project with the code to be tested.

Advertisements
  1. Leave a comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: