Could not load file or assembly 'EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'

asp.net asp.net5 asp.net-mvc c# entity-framework-6

Question

I am using this link, ASP.NET 5, and Entity Framework 6 (exactly 6.1.3). tried every alternative remedy, including

  1. Version deletion in appconfig
  2. Adding <dependentAssembly>
  3. using EntityFramework 6 again to reinstallUpdate-Package -reinstall EntityFramework
  4. Verify the EntityFramwork.SqlServer
  5. I cleaned up %temp%, performed a clean build, then rebuilt standalone.

I encounter an error.

[DbConfigurationType(typeof(CodeConfig))]    
public class MyContext : DbContext
{
public MyContext()
        : base("DefaultConnection") <-- error here
    {
    }
 }

but was still unable to fix this issue; any useful links would be welcomed.

Could not load file or assembly 'EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The system cannot find the file specified.":"EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"

Instance Trace

at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)
   at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
   at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
   at System.Activator.CreateInstance(Type type, Boolean nonPublic)
   at System.Data.Entity.Utilities.TypeExtensions.CreateInstance[T](Type type, Func`2 exceptionFactory)
   at System.Data.Entity.Utilities.TypeExtensions.CreateInstance[T](Type type, Func`3 typeMessageFactory, Func`2 exceptionFactory)
   at System.Data.Entity.Infrastructure.DependencyResolution.DbConfigurationManager.<.ctor>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.Infrastructure.DependencyResolution.InternalConfiguration.get_Instance()
   at System.Data.Entity.DbConfiguration.get_DependencyResolver()
   at System.Data.Entity.DbContext.InitializeLazyInternalContext(IInternalConnection internalConnection, DbCompiledModel model)
   at System.Data.Entity.DbContext..ctor(String nameOrConnectionString)
   at myproject.data.myprojectContext..ctor() in D:\Projects\Personal\myproject\myproject.data\myprojectContext.cs:line 12
   at myproject.data.Infrastructure.DatabaseFactory.Get() in D:\Projects\Personal\myproject\myproject.data\Infrastructure\DatabaseFactory.cs:line 9
   at myproject.data.Repository`1.get_DataContext() in D:\Projects\Personal\myproject\myproject.data\Repository.cs:line 28
   at myproject.data.Repository`1..ctor(IDatabaseFactory databaseFactory) in D:\Projects\Personal\myproject\myproject.data\Repository.cs:line 21
   at myproject.data.Repository.ProfileRepository..ctor(IDatabaseFactory databaseFactory) in D:\Projects\Personal\myproject\myproject.data\Repository\ProfileRepository.cs:line 9

Web.Config

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
  </configSections>
  <connectionStrings>
    <add name="DefaultConnection" providerName="System.Data.SqlClient" connectionString="...." />
  </connectionStrings>
  <entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
      <parameters>
        <parameter value="mssqllocaldb" />
      </parameters>
    </defaultConnectionFactory>
    <providers>
      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
    </providers>
  </entityFramework>
</configuration>
1
8
5/3/2016 2:39:31 PM

Popular Answer

Initially, confirm the EF version you are using. Verify the current version. You may manage EF upgrading through NuGet if you wish to upgrade your version.

Click "Manage" next to "Entity Framework" in your project solution's "Manage NuGet packet for Solution" menu.

Check your app.config right now. maybe the incorrect version number. The version number for name="entityFramework" should be accurate.

In addition to this, you should try installing the EntityFramework.SqlServer nuget package by running the following command in the package manager console.

Install-Package EntityFramework.SqlServer -Version 7.0.0-beta6 -Pre

0
5/25/2016 12:27:57 PM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow