无法加载文件或程序集&System; Web.WebPages.Razor,Version = 3.0.0.0,Culture = neutral,PublicKeyToken = 31bf3856ad364e35'

时间:2016-02-20 22:03:40

标签: asp.net-mvc

我无法分辨这个名称,版本,文化和参考的来源。我已根据错误的建议启用了注册表中的日志记录,并确认详细输出中的文件没有此引用。我正在使用Umbraco 7.4和VS 2015社区。

我很感激任何帮助使这个输出有用。

=== Pre-bind state information ===
LOG: DisplayName = System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
 (Fully-specified)
LOG: Appbase = file:///C:/ESC_Test/ESCProject/
LOG: Initial PrivatePath = C:\ESC_Test\ESCProject\bin
Calling assembly : System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35.
===

LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\ESC_Test\ESCProject\web.config
LOG: Using host configuration file: C:\Users\Mike\Documents\IISExpress\config\aspnet.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Post-policy reference: System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
LOG: Attempting download of new URL file:///c:/tmp/Temporary ASP.NET Files/vs/f2aa3d7e/9192dbba/System.Web.WebPages.Razor.DLL.
LOG: Attempting download of new URL file:///c:/tmp/Temporary ASP.NET Files/vs/f2aa3d7e/9192dbba/System.Web.WebPages.Razor/System.Web.WebPages.Razor.DLL.
LOG: Attempting download of new URL file:///C:/ESC_Test/ESCProject/bin/System.Web.WebPages.Razor.DLL.
WRN: Comparing the assembly name resulted in the mismatch: Major Version
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.

2 个答案:

答案 0 :(得分:1)

查看您的Views\Web.config

  <configSections>
    <sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
      <section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
      <section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
    </sectionGroup>
  </configSections>

(从ASP.Net MVC 5项目复制)

答案 1 :(得分:0)

作为新人,我想在为我的非营利组织志愿参与此项目时了解可用的工具。我安装了Web Matrix,VS 2012网络版,VS 2013和VS 2015社区以及VS Code。通过这些工具,我访问了VS项目。显然,这个问题的原因是安装和使用相同NuGet更新和下载的各种版本。

从这次经历中学到的一点是,与VS不同,Web Matrix允许搜索项目文件的内容。虽然我的Umbraco项目包含6个web.config文件,但是没有包含错误中报告的原始引用。但是,使用Web Matrix,我确实发现了包含该引用的其他文件: web.config in the obj folder and ESCProject.csproj in the project root 请关闭此问题,因为我的解决方案,即使我对这些工具有一些痛苦的熟悉,是删除VS和项目,并在清理环境后重新开始。

我想对所有提供帮助的人表示非常感谢,因为我很高兴知道,当我筋疲力尽时,我可以求助于社区寻求帮助。

再次感谢。请关闭这个问题。