Nuget trouble (again)

nuget logoKeeping the versions of packages in sync was difficult today, again.
Now I tried testing my data access code with FakeDbSet. This is an in-memory store for your data, the owner describes it as

A ready to use FakeDbSet for faking Entity Framework code.

The version of EntityFramework I used for the data access code and the version needed for FakeDbSet were different. Running the unit test would throw an exception:

Could not load file or assembly ‘EntityFramework, Version=,
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)

I remembered the solution Visual Studio offered the previous time and added a binding redirect. This solved the problem.

  <!-- other stuff removed for clearness -->
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
        <assemblyIdentity name="EntityFramework" culture="neutral" 
publicKeyToken="b77a5c561934e089" />
        <bindingRedirect oldVersion="" newVersion="" />

Not to say I’m happy with a version number in my config, but this is in my unit test and that is not (currently) part of my product.


About erictummers

Working in a DevOps team is the best thing that happened to me. I like challenges and sharing the solutions with others. On my blog I’ll mostly post about my work, but expect an occasional home project, productivity tip and tooling review.
This entry was posted in Test and tagged , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.