MVC 5 on Mono: Could not load file or assembly 'System.Web.Entity' or one of its dependencies

28,857

Solution 1

I know this is an old thread, but I ran across this while starting to port over an MVC project from VS for windows to VS for Mac. I found a better solution was to delete the reference to System.Web.Entity, and add the NuGet package System.Web.Http.Common. Hope it helps.

Solution 2

I was able to work around this problem by getting the System.Web.Entity.dll file from my Windows box. I found mine in C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.1\.

Once I copied that to the bin folder of my project on my Mac, and updated the reference to include a HintPath...

<Reference Include="System.Web.Entity" >
  <HintPath>..\bin\System.Web.Entity.dll</HintPath>
</Reference>

the project would build in Xamarin Studio. It still showed the red X next to the reference (yes, even if I specified that it was a local copy and added a HintPath), but at least it could find it.

I ended up getting another error about being unable to load System.Drawing.BitmapSuffixInSameAssemblyAttribute, but hey, small progress!

Solution 3

Wouldn't it be better/easier for you just to replace that old EntityFramework with new one from NuGet, I think that will solve most of our problems with other references

Share:
28,857
jeffmaher
Author by

jeffmaher

Updated on June 23, 2020

Comments

  • jeffmaher
    jeffmaher about 4 years

    Goal: Startup a ASP.NET MVC 5 project on Mono via Xamarain Studio.

    Error after starting server: Could not load file or assembly 'System.Web.Entity' or one of its dependencies.

    enter image description here

    Error in Xamarin Studio:

    enter image description here

    Background: The project was created in Visual Studio 2013 as a default web project. Most of the configuration is out of the box. Code for it can be viewed here on GitHub. I have the latest and greatest Mono and Xamarin Studio as of writing. The .NET Entity Framework is a resolved dependency and there are no build issues noted in Xamarin Studio.

    How do I get this project up and running? How do I resolve this dependency?