Changing targeted .NET version for a project means web.config changes for EF

I am upgrade an internal system from .NET 4.0 to 4.5 so that I can use the Team API features in TFS. The system is based around a WCF web service that links our customer help desk system to TFS to keep bug reports in sync. It uses Entity Framework to access our help desk SQL DB.

When I changed the targeted .NET framework  for the WCF project, I started to get warning to update the Nuget managed references for EF, which I did.

Once this was done, all my unit tests passed, however when i tried to load my test system it got the following  error (when it tried to create the EF DbContext)

An exception of type 'System.TypeInitializationException' occurred in EntityFramework.dll but was not handled in user code

Additional information: The type initializer for 'System.Data.Entity.Internal.AppConfig' threw an exception.

Turns out the issue was a reference to EF in the WCF project web.config

   
     

should have been

   
     

A misleading error message don’t you think?