Could not load assembly WebPages.Deployment version 2 at host?

Ivy picture Ivy · Jul 6, 2012 · Viewed 25.9k times · Source

I have a ASP.NET MVC 2 website (VS2010) that I have upgraded to ASP.NET MVC 3 (VS2012) and this works fin on local IIS7 but when publishing it I get this exception on host :

 Could not load file or assembly 'System.Web.WebPages, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

After some seartch I found this that states that I should set CopyLocal on some of the references(inlcuding the System.Web.WebPages) and also use the publish tool in VS2012, but this generated the following exception?

Could not load file or assembly 'System.Web.WebPages.Deployment, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

And I can´t find any Deployment dll to set copyLocal?

How could I solve this?

Answer

magritte picture magritte · Jul 6, 2012

Have a read of http://joel.net/getting-asp.net-mvc-3-working-on-discountasp.net

You need to add a reference to System.Web.WebPages.Deployment and set that also to CopyLocal.