一般System.Web.Razor错误(还邮政项目) [英] general System.Web.Razor error (also Postal project)

查看:695
本文介绍了一般System.Web.Razor错误(还邮政项目)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

VS 2012,使用MVC4应用邮政0.8.0

VS 2012, MVC4 app using Postal 0.8.0

在我的NuGet安装安德鲁的戴维的邮政0.8.0它的工作原理我的机器上,但是当我部署它,我得到这个错误信息:

When I NuGet install Andrew’s Davey’s Postal 0.8.0 it works on my development machine but when I deploy it I get this error message:

无法加载文件或程序集System.Web.Razor,版本= 2.0.0.0,文化=中性公钥= 31bf3856ad364e35或它的一个依赖。该系统找不到指定的文件。

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

我花了好几天试图让这个工作。这是什么问题的原因,你如何解决这个问题?

I have spent several days trying to get this to work. What is the cause of this problem and how do you fix it?

推荐答案

在你的NuGet安装邮政它取代System.Web.Razor 2.0 System.Web.Razor 1.0。我不得不删除提及System.Web.Razor 1.0,然后在System.Web.Razor 2.0加回。你必须加设复制本地为True属性System.Web.Razor,然后重新生成项目。有一次,我这样做,VS2012复制System.Web.Razor.dll到部署的bin目录,并清除了问题。

When you install Postal with NuGet it replaces System.Web.Razor 2.0 with System.Web.Razor 1.0. I had to delete the reference to System.Web.Razor 1.0 and then added back in System.Web.Razor 2.0. You have to additionally set Copy Local to True in the Properties for System.Web.Razor and then rebuild the project. Once I did that VS2012 copied the System.Web.Razor.dll to the deployed bin directory and the problem cleared.

邮政还增加了这些相关的到web.config。我把他们赶走,它仍然正常工作。

Postal also adds these dependency's to the web.config. I removed them and it still works properly.

  <dependentAssembly>
    <assemblyIdentity name="System.Web.Razor" publicKeyToken="31bf3856ad364e35" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-1.0.0.0" newVersion="2.0.0.0" />
  </dependentAssembly>
        <dependentAssembly>
    <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-1.3.0.0" newVersion="1.3.0.0" />
  </dependentAssembly>
  <dependentAssembly>
    <assemblyIdentity name="RazorEngine" publicKeyToken="9ee697374c7e744a" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-3.0.8.0" newVersion="3.0.8.0" />
  </dependentAssembly>

更新 13年3月3日

AD刚刚发布了更新System.Web.Razor到2.0邮政v0.8.2。

AD has just released Postal v0.8.2 which updated System.Web.Razor to 2.0.

该WebGrease依赖,ASP.NET的发布和Web Tools 2012.2( http://www.asp.net/vnext/overview/fall-2012-update )似乎是默认了。

The WebGrease dependency, with the release of ASP.NET and Web Tools 2012.2 (http://www.asp.net/vnext/overview/fall-2012-update) appears to be the default now.

这篇关于一般System.Web.Razor错误(还邮政项目)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆