Could not load assembly WebPages.Deployment versio

2019-04-04 03:40发布

问题:

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?

回答1:

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.