Major Productions
Major Productions

Reputation: 6042

Entity Framework version error in my small code first project

I'm writing a small test project in order to get my feet wet with EF code first. Unfortunately, when I try compiling, I get the following error:

Assembly 'Backend, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' uses   
'EntityFramework, Version=4.3.1.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'  
which has a higher version than referenced assembly 'EntityFramework, Version=4.1.0.0,  
Culture=neutral, PublicKeyToken=b77a5c561934e089'   c:\Users\Kevin\Documents\Visual   
Studio 2010\Projects\CFTest\Backend\bin\Debug\Backend.dll   CFTest

For some reason, there's a versioning conflict, but I dunno how to fix it.

EDIT: My App.config:

<?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=4.3.1.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
  </configSections>
  <entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework">
      <parameters>
        <parameter value="Data Source=.\SQLEXPRESS; Integrated Security=True; MultipleActiveResultSets=True" />
      </parameters>
    </defaultConnectionFactory>
  </entityFramework>
</configuration>

Upvotes: 1

Views: 1840

Answers (2)

Major Productions
Major Productions

Reputation: 6042

My backend project had one version of EF while my MVC project came with another by default. Solved.

Upvotes: 2

Chris Knight
Chris Knight

Reputation: 1476

It is conflict with the version of the .NET framework your project is using, and the version of the .NET Framework that the EF dll was compiled in. If you go to the add reference window for the project, the listing should say what .NET Framework version each DLL uses. Change you project target to use that version as well.

Upvotes: 0

Related Questions