How can I solve this problem? Entity Framework

-1

I have a old project and update something on db, but if I edit, I receive error. What should I do?

Exception detail

System.TypeInitializationException was caught HResult=-2146233036 Message=The type initializer for 'System.Data.Entity.Internal.AppConfig' threw an exception. Source=EntityFramework TypeName=System.Data.Entity.Internal.AppConfig StackTrace: at System.Data.Entity.Internal.AppConfig.get_DefaultInstance() at System.Data.Entity.Internal.LazyInternalConnection..ctor(DbContext context, String nameOrConnectionString) at System.Data.Entity.DbContext..ctor(String nameOrConnectionString) at LetterTracing.Lib.DemoT2016Entities..ctor() in c:\Users\PC\Documents\Visual Studio 2013\Projects\LetterTracing\LetterTracing.Lib\DbModel.Context.cs:line 18 at LetterTracing.Lib.KullaniciDAO.Giris(String kullaniciAd, String sifre) in c:\Users\PC\Documents\Visual Studio 2013\Projects\LetterTracing\LetterTracing.Lib\KullaniciDAO.cs:line 20 at LetterTracing.Win.LoginForm.btnGiris_Click(Object sender, EventArgs e) in c:\Users\PC\Documents\Visual Studio 2013\Projects\LetterTracing\LetterTracing.Win\LoginForm.cs:line 75 InnerException: System.Configuration.ConfigurationErrorsException HResult=-2146232062 Message=An error occurred creating the configuration section handler for entityFramework: Could not load file or assembly 'EntityFramework, Version=6.4.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) (C:\Users\PC\Documents\Visual Studio 2013\Projects\LetterTracing\LetterTracing.Win\bin\Debug\Mektup Takip Programı.vshost.exe.Config line 5) Source=System.Configuration BareMessage=An error occurred creating the configuration section handler for entityFramework: Could not load file or assembly 'EntityFramework, Version=6.4.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) Filename=C:\Users\PC\Documents\Visual Studio 2013\Projects\LetterTracing\LetterTracing.Win\bin\Debug\Mektup Takip Programı.vshost.exe.Config Line=5 StackTrace: at System.Configuration.BaseConfigurationRecord.FindAndEnsureFactoryRecord(String configKey, Boolean& isRootDeclaredHere) at System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject) at System.Configuration.BaseConfigurationRecord.GetSection(String configKey) at System.Configuration.ClientConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection(String sectionName) at System.Configuration.ConfigurationManager.GetSection(String sectionName) at System.Data.Entity.Internal.AppConfig..ctor() at System.Data.Entity.Internal.AppConfig..cctor() InnerException: System.IO.FileLoadException HResult=-2146234304 Message=Could not load file or assembly 'EntityFramework, Version=6.4.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) Source=System.Configuration FileName=EntityFramework, Version=6.4.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 FusionLog==== Pre-bind state information === LOG: DisplayName = EntityFramework, Version=6.4.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 (Fully-specified) LOG: Appbase = file:///C:/Users/PC/Documents/Visual Studio 2013/Projects/LetterTracing/LetterTracing.Win/bin/Debug/ LOG: Initial PrivatePath = NULL

Calling assembly : System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a.

LOG: This bind starts in default load context. LOG: Using application configuration file: C:\Users\PC\Documents\Visual Studio 2013\Projects\LetterTracing\LetterTracing.Win\bin\Debug\Mektup Takip Programı.vshost.exe.Config LOG: Using host configuration file: LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config. LOG: Post-policy reference: EntityFramework, Version=6.4.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 LOG: Attempting download of new URL file:///C:/Users/PC/Documents/Visual Studio 2013/Projects/LetterTracing/LetterTracing.Win/bin/Debug/EntityFramework.DLL. WRN: Comparing the assembly name resulted in the mismatch: Minor Version ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.

        StackTrace:
             at System.Configuration.TypeUtil.GetTypeWithReflectionPermission(IInternalConfigHost host, String typeString, Boolean throwOnError)
             at System.Configuration.RuntimeConfigurationRecord.RuntimeConfigurationFactory.Init(RuntimeConfigurationRecord configRecord, FactoryRecord factoryRecord)
             at System.Configuration.RuntimeConfigurationRecord.RuntimeConfigurationFactory.InitWithRestrictedPermissions(RuntimeConfigurationRecord configRecord, FactoryRecord factoryRecord)
             at System.Configuration.RuntimeConfigurationRecord.CreateSectionFactory(FactoryRecord factoryRecord)
             at System.Configuration.BaseConfigurationRecord.FindAndEnsureFactoryRecord(String configKey, Boolean& isRootDeclaredHere)
        InnerException: 

App.Config code

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>
    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.4.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
  </configSections>
  <entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
      <parameters>
        <parameter value="v12.0" />
      </parameters>
    </defaultConnectionFactory>
    <providers>
      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
      <provider invariantName="System.Data.SQLite.EF6" type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6" />
    </providers>
  </entityFramework>
  <connectionStrings>
    <add name="DemoT2016Entities" connectionString="metadata=res://*/DbModel.csdl|res://*/DbModel.ssdl|res://*/DbModel.msl;provider=System.Data.SQLite.EF6;provider connection string='data source=&quot;DemoT2016.db&quot;'" providerName="System.Data.SQLite" />
  </connectionStrings>
  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
  </startup>
  <system.data>
    <DbProviderFactories>
      <remove invariant="System.Data.SQLite.EF6" />
      <add name="SQLite Data Provider (Entity Framework 6)" invariant="System.Data.SQLite.EF6" description=".NET Framework Data Provider for SQLite (Entity Framework 6)" type="System.Data.SQLite.EF6.SQLiteProviderFactory, System.Data.SQLite.EF6" />
    </DbProviderFactories>
  </system.data>
</configuration>

Error Screen

c#
entity-framework
sqlite
app-config
asked on Stack Overflow Mar 3, 2020 by user3275631 • edited Mar 3, 2020 by user3275631

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0