剃刀编译器警告/错误 - ASP.NET MVC 4 [英] Razor Compiler Warning/Errors - ASP.NET MVC 4
问题描述
我有这似乎已在这里报告了一个问题:
I have an issue which seems to have been reported here:
<一个href=\"http://stackoverflow.com/questions/4158573/need-razor-view-engine-auto-complete-to-work-in-a-class-library\">Need剃刀视图引擎自动完成,以在类库工作?
我的问题是以下警告:
G:\\问责\\问责\\查看\\ LedgerUser \\ EditorTemplates \\ LedgerServiceViewModel.cshtml:
ASP.NET运行时错误:没有为没有注册的生成提供
扩展名.cshtml。你可以注册一个在
在machine.config中或web.config中一节。
请确保有一个BuildProviderAppliesToAttribute属性,该属性
包括值网络或所有。
G:\Accountable\Accountable\Views\LedgerUser\EditorTemplates\LedgerServiceViewModel.cshtml: ASP.NET runtime error: There is no build provider registered for the extension '.cshtml'. You can register one in the section in machine.config or web.config. Make sure is has a BuildProviderAppliesToAttribute attribute which includes the value 'Web' or 'All'.
这个问题是在我所有的意见明显。下面的示例图像。
This issue is apparent in all my views. Sample images below.
现在所有文章和网上,我发现引用引用来添加各种Web.config文件(如previous帖子中提到)选项,但是这似乎并没有工作,因为我有这些配置在违约该项目。这里是我的网站的Configs:
Now all posts and references online that I have found are referencing to adding various Web.config (as mentioned in the previous post) options, but this doesn't seem to work, as I have these configurations defaulted in the project. Here are my Web Configs:
我想这个问题可能同时IM也越来越上查看以下编译器错误:
I think this issue maybe while im also getting the following compiler errors on the Views:
名字'HTML'不存在于当前上下文存在
The name 'Html' does not exist in the current context
我在做什么错了?
推荐答案
Arrrgghhh我已经错过了从根web.config以下内容:
Arrrgghhh i had missed the following from the ROOT Web.config:
<compilation debug="true" targetFramework="4.0">
<!-- New -->
<assemblies>
<add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.Helpers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.WebPages, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
</assemblies>
</compilation>
这允许固定的错误,让我在视图中使用IntelliSense。
This allowed fixed the error and allowed me to use Intellisense within the View.
这篇关于剃刀编译器警告/错误 - ASP.NET MVC 4的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!