我有一个 ASP.NET MVC 2网站(VS2010),我已经升级到 ASP.NET MVC 3(VS2012),这在本地IIS7上工作,但是在发布它时,我在主机上收到此异常:
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.
经过一番讨论,我发现这说明我应该在某些引用(包括System.Web.WebPages)上设置CopyLocal,并在VS2012中使用发布工具,但这会产生以下异常?
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.
而且我找不到任何部署 dll 来设置 copyLocal?
我该如何解决这个问题?
阅读 http://joel.net/getting-asp.net-mvc-3-working-on-discountasp.net
您需要添加对 System.Web.WebPages.Deployment 的引用,并将其也设置为 CopyLocal。