title: Why is Entity Framework 6.1.3 throwing a "Could not load type 'System.Data.Entity.Infrastructure.TableExistenceChecker'"
body: <p>Brand new project and entity framework will not start due to the exception being thrown as soon as the context instance is created.   </p>
  
  <p>Entity framework throws the following exception:</p>
  
  <blockquote>
    <p>Could not load type 'System.Data.Entity.Infrastructure.TableExistenceChecker' from assembly 'EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.</p>
  </blockquote>
  
  <p>References:</p>
  
  <ul>
  <li>EntityFramework </li>
  <li>EntityFramework.SqLServer</li>
  </ul>
  
  <p>Via the nuget package manager:</p>
  
  <pre><code>Install-Package entityframework
  </code></pre>
  
  <p>Very simple context and entity:</p>
  
  <pre><code>public class TextDbContext : DbContext
  {
      public TextDbContext()
          : base("Test")
      {
      }
  
      public DbSet&lt;TestEntity&gt; TestEntity { get; set; }
  }
  
  public class TestEntity
  {
      public int Id { get; set; } 
      public string Name { get; set; }
  }
  
  static void Main(string[] args)
  {
      var test = ConfigurationManager.ConnectionStrings["Test"].ConnectionString;
  
      using (var conn = new SqlConnection(test))
      {
          conn.Open();
          var cmd = new SqlCommand("Select * from testtable", conn);
          var result = cmd.ExecuteReader();
      }
      //exception thrown on this line is the same as the one in the context
      var instance = SqlProviderServices.Instance;
  
      using (var db = new TextDbContext())
      {
           var item = new TestEntity
           {
               Name = "xyz"
           };
           db.TestEntity.Add(item);
           db.SaveChanges();
      }
  }
  </code></pre>
  
  <p>Here is the current app.config file:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;configuration&gt;
      &lt;configSections&gt;
          &lt;section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral,  PublicKeyToken=b77a5c561934e089" requirePermission="false" /&gt;
      &lt;/configSections&gt;
      &lt;connectionStrings&gt;
          &lt;add name="Test" connectionString="server=localhost;database=Test;Data Source=localhost;Integrated Security=True;Pooling=True" providerName="System.Data.SqlClient" /&gt;
      &lt;/connectionStrings&gt;
      &lt;startup&gt;
         &lt;supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" /&gt;
      &lt;/startup&gt;
      &lt;entityFramework&gt;
          &lt;defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" /&gt;
           &lt;providers&gt;
              &lt;provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" /&gt;
          &lt;/providers&gt;
      &lt;/entityFramework&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <p>Stack trace is as follows:</p>
  
  <pre><code>   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
     at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
     at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
     at System.Reflection.RuntimePropertyInfo.GetValue(Object obj, BindingFlags invokeAttr, Binder binder, Object[] index, CultureInfo culture)
     at System.Reflection.RuntimePropertyInfo.GetValue(Object obj, Object[] index)
     at System.Data.Entity.Utilities.MemberInfoExtensions.GetValue(MemberInfo memberInfo)
     at System.Data.Entity.Infrastructure.DependencyResolution.ProviderServicesFactory.GetInstance(Type providerType)
     at System.Data.Entity.Infrastructure.DependencyResolution.ProviderServicesFactory.GetInstance(String providerTypeName, String providerInvariantName)
     at System.Data.Entity.Internal.AppConfig.&lt;.ctor&gt;b__2(ProviderElement e)
     at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
     at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
     at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
     at System.Data.Entity.Internal.AppConfig.&lt;.ctor&gt;b__1()
     at System.Lazy`1.CreateValue()
     at System.Lazy`1.LazyInitValue()
     at System.Lazy`1.get_Value()
     at System.Data.Entity.Internal.AppConfig.get_DbProviderServices()
     at System.Data.Entity.Infrastructure.DependencyResolution.AppConfigDependencyResolver.RegisterDbProviderServices()
     at System.Data.Entity.Infrastructure.DependencyResolution.AppConfigDependencyResolver.GetServiceFactory(Type type, String name)
     at System.Data.Entity.Infrastructure.DependencyResolution.AppConfigDependencyResolver.&lt;&gt;c__DisplayClass1.&lt;GetService&gt;b__0(Tuple`2 t)
     at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
     at System.Data.Entity.Infrastructure.DependencyResolution.AppConfigDependencyResolver.GetService(Type type, Object key)
     at System.Data.Entity.Infrastructure.DependencyResolution.DbDependencyResolverExtensions.GetServiceAsServices(IDbDependencyResolver resolver, Type type, Object key)
     at System.Data.Entity.Infrastructure.DependencyResolution.AppConfigDependencyResolver.GetServices(Type type, Object key)
     at System.Data.Entity.Infrastructure.DependencyResolution.ResolverChain.&lt;&gt;c__DisplayClass6.&lt;GetServices&gt;b__5(IDbDependencyResolver r)
     at System.Linq.Enumerable.&lt;SelectManyIterator&gt;d__14`2.MoveNext()
     at System.Linq.Enumerable.&lt;ConcatIterator&gt;d__71`1.MoveNext()
     at System.Linq.Enumerable.&lt;OfTypeIterator&gt;d__aa`1.MoveNext()
     at System.Data.Entity.Utilities.IEnumerableExtensions.Each[T](IEnumerable`1 ts, Action`1 action)
     at System.Data.Entity.Infrastructure.DependencyResolution.InternalConfiguration.Lock()
     at System.Data.Entity.Infrastructure.DependencyResolution.DbConfigurationManager.&lt;.ctor&gt;b__1()
     at System.Lazy`1.CreateValue()
     at System.Lazy`1.LazyInitValue()
     at System.Lazy`1.get_Value()
     at System.Data.Entity.Infrastructure.DependencyResolution.DbConfigurationManager.GetConfiguration()
     at System.Data.Entity.DbContext.InitializeLazyInternalContext(IInternalConnection internalConnection, DbCompiledModel model)
     at System.Data.Entity.DbContext..ctor(String nameOrConnectionString)
     at test2.TextDbContext..ctor() in \\srv\users\carl.tierney\Documents\Visual Studio 2013\Projects\test2\test2\test2context.cs:line 13
     at test2.Program.Main(String[] args) in \\srv\users\carl.tierney\Documents\Visual Studio 2013\Projects\test2\test2\Program.cs:line 13
     at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
     at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
     at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
     at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
     at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
     at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
     at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state
     at System.Threading.ThreadHelper.ThreadStart()
  </code></pre>