无法在主机上加载程序集WebPages.Deployment版本2?

时间:2012-07-06 09:55:13

标签: asp.net-mvc visual-studio iis hosting .net-assembly

我有一个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.

在一些seartch之后,我发现this表示我应该在一些引用上设置CopyLocal(包括System.Web.WebPages)并且还使用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.

我找不到任何Deployment dll来设置copyLocal?

我怎么解决这个问题?

1 个答案:

答案 0 :(得分:19)

阅读http://joel.net/getting-asp.net-mvc-3-working-on-discountasp.net

您需要添加对System.Web.WebPages.Deployment的引用,并将其也设置为CopyLocal。