pr0g33k

Could not load file or assembly WebMatrix.WebData or one of its dependencies

One thing that you might run into when setting up SimpleMembership in a Blank MVC 4 project is this error:

Could not load file or assembly 'WebMatrix.WebData' or one of its dependencies

I've encountered this several times and now I'm putting here so I won't forget.

If you capture the exception, it will probably complain that it's trying to load an assembly specified in the Web.config. If you're trying to set up SimpleMembership, your Web.Config probably resembles this:

<membership>
  <providers>
    <add name="DefaultMembershipProvider" type="WebMatrix.WebData.SimpleMembershipProvider, WebMatrix.WebData" />
  </providers>
</membership>
<roleManager enabled="true">
  <providers>
    <add name="DefaultRoleProvider" type="WebMatrix.WebData.SimpleRoleProvider, WebMatrix.WebData" />
  </providers>
</roleManager>
    

If you haven't already, add a reference to WebMatrix.WebData. But there's one more step you'll need to take. Right-click on the reference to WebMatrix.WebData and select "Properties." In the properties explorer, find "Copy Local" and change the value to "True."

That should clear it up.

Posted on 4/29/2013 at 09:04 PM , Edited on 4/30/2013 at 04:04 PM
Tags: MVC

Comments:

Leave a comment
  1. CAPTCHA