Reputation: 111
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.
Upvotes: 9
Views: 25494
Reputation: 13755
Is this a solution that you have created or one you have downloaded (as a sample or as work done by a colleague)? Do you have an up to data version of NuGet installed within Visual Studio and have you checked installed packages for the project - you may need to restore packages if you have downloaded the solution from Source Control or as a zip sample online.
The easiest way to do this is to check that NuGet Package Manager is up to date in "Tools" > "Extensions and Updates" and then (with the applicable project selected in Visual Studio) select "Project" > "Manage NuGet Packages". If there are installed Packages which are not found in your solution packages directory then NuGet should offer to restore them for you.
Alternatively you may have added a package which has a dependency on that package, and you either do not have it installed or have a previous version.
To install the package within NuGet Package Manager Console type-
Install-Package Microsoft.AspNet.WebPages.Data
Or search for "Microsoft.AspNet.WebPages.Data" in the "Manage NuGet Packages" window, accessed via the instructions above.
If you have a prior version of the package installed, you may need to remap that version number to the version 3.0.0.0 with the following code in your project config (most likely Web.config) file in order to avoid breaking packages with dependencies on the previous version-
<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>
Upvotes: 26
Reputation: 1
Following solution helped us
step 1: Delete the service reference and build the app (will show error) step 2: Add service reference again -> click on advance button step 3: uncheck "Reuse types in referenced assemblies" and then click on OK step 4: Rebuild the application
Upvotes: 0
Reputation: 909
The only thing that worked for me was editing the properties of the DLL (right-click the WebMatrix.WebData DLL in solution explorer and select Properties), changing the "Copy Local" property to true. Same for the WebMatrix.Data DLL.
Upvotes: 0
Reputation: 177
I had a similar problem, and I fixed it by doing the following:
Installing the package via package manager console(from visual studio) Use the following commands:
PM> Install-package WebMatrix.Data
PM> Install-package WebMatrix.WebData
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.
Upvotes: 3