Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 652
jeffmaher Avatar asked Dec 05 '14 23:12

jeffmaher


2 Answers

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.

like image 86
Patrick Boyd Hesser III Avatar answered Sep 24 '22 00:09

Patrick Boyd Hesser III


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!

like image 30
jonnybot Avatar answered Sep 24 '22 00:09

jonnybot