1

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>

2 Answers 2

2

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

Sign up to request clarification or add additional context in comments.

3 Comments

thanks for adding the solution. Now that I think of it, I have had the same issue with the same resolution before. Thanks.
its pretty clear in the error message - backend has 4.3 and the web project during compile shows 4.3.1. You can remove both and simply do a install-package entityframework on both (or use -pre to get EF 5 RC code)
Yeah, but I didn't realize that my MVC 3 project came pre-loaded with a reference to EF 4.1 (I used the default project, not an empty one). Backend is a separate C# class library project that I explicitly installed a reference to 4.3.1 in. So, it was a conflict between my explicit EF reference and the one VS installs by default, which spanned two projects. But, whatever. It's fixed now and it's a lesson learned.
0

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.

2 Comments

My project targets .NET 4, just like the DLLs
Maybe one is using the Client Profile version? That could cause a conflict. Are you 100% sure the dll uses 4.0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.