Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Could not load file or assembly 'WebMatrix.Data, Version=3.0.0.0

Tags:

asp.net-mvc

Could not load file or assembly 'WebMatrix.Data, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

like image 400
Jagmohan Kasana Avatar asked Apr 20 '14 10:04

Jagmohan Kasana


People also ask

How do you fix Could not load file or assembly or one of its dependencies?

There are some workarounds for this issue: The dll file may not be in /bin folder. Just copy the dll file to /bin folder or set this preference Copy Local = True from Visual Studio. If the problem persists, check if the version of the assembly that is referenced is different than the version it is looking for.


1 Answers

I had a similar problem, and I fixed it by doing the following:

  1. Installing the package via package manager console(from visual studio) Use the following commands:

    PM> Install-package WebMatrix.Data

    PM> Install-package WebMatrix.WebData

  2. Add a binding Redirect in Web.config file Between <runtime></runtime> tags:

    
    
    
    <dependentAssembly>
        <assemblyIdentity name="WebMatrix.Data" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
        <bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
       </dependentAssembly>
    
    

3.I've copied both dlls from: /YourProject/packages folder to /YourProject/bin folder

(Optional) If you can't find the dlls in /YourProject/packages folder, try search for the dlls in /YourProject/bin/Debug folder, and copy/Paste them into /YourProject/bin folder instead.

It solved the problem for me.

like image 71
Dmitry Avatar answered Sep 18 '22 01:09

Dmitry