问题描述
我写NOP商业和我的HTML佣工给我的智能感知错误的插件。我得到的红色线条,强调他们与错误:
I am writing a plugin for Nop Commerce and my HTML helpers are giving me intellisense errors. I get red lines underlining them and the errors:
特性扩展方法不能被使用,因为它不是ISO-2 C#语言规范的一部分
Feature 'extension method' cannot be used because it is not part of the ISO-2 C# language specification
功能的lambda表达式'不能使用,因为它不是ISO-2 C#语言规范的一部分
Feature 'lambda expression' cannot be used because it is not part of the ISO-2 C# language specification
下面是我的代码:
@{
Layout = "";
}
@model Nop.Plugin.Widgets.HelloWorld.Models.ConfigurationModel
@using Nop.Web.Framework;
@Html.Action("StoreScopeConfiguration", "Setting", new { area = "Admin" })
@using (Html.BeginForm())
{
<fieldset>
<legend><strong>Hello World Configuration</strong></legend>
<table class="adminContent">
<tr>
<td class="adminTitle">
@Html.OverrideStoreCheckboxFor(model => model.Greeting_OverrideForStore, model => model.Greeting, Model.ActiveStoreScopeConfiguration)
@Html.NopLabelFor(model => model.Greeting):
</td>
<td class="adminData">
@Html.EditorFor(model => model.Greeting)
@Html.ValidationMessageFor(model => model.Greeting)
</td>
</tr>
<tr>
<td class="adminTitle">
@Html.OverrideStoreCheckboxFor(model => model.Name_OverrideForStore, model => model.Name, Model.ActiveStoreScopeConfiguration)
@Html.NopLabelFor(model => model.Name):
</td>
<td class="adminData">
@Html.EditorFor(model => model.Name)
@Html.ValidationMessageFor(model => model.Name)
</td>
</tr>
</table>
</fieldset>
<br />
<table class="adminContent">
<tr>
<td colspan="2">
<input type="submit" name="save" class="k-button" value="@T("Admin.Common.Save")" />
</td>
</tr>
</table>
}
我的屏幕看起来像:
My screen looks like:
我'已经寻找的答案小时,但还没有找到一个实际工作。该项目是一个代码库,并且是ASP.NET 4.5.1像解决方案的其余部分。有没有错误,当我建立。我缺少引用或using语句?我不知道是怎么回事。
I've looked for hours for the answer but haven't found one that actually works. The project is a code library and is on ASP.NET 4.5.1 like the rest of the solution. There are no errors when I build. Am I missing a reference or a using statement? I'm not sure what is going on.
推荐答案
我能得到这个工作(使用VS2013)的唯一途径是该类库项目转换为MVC项目:
The only way I was able to get this working (using VS2013) was to convert the Class Library projects into MVC projects:
- 在<的PropertyGroup>,添加< ProjectTypeGuids> {349c5851-65df-11DA-9384-00065b846f21} {fae04ec0-301f-11D3-bf4b-00c04f79efbc}< / ProjectTypeGuids>
-
在底部添加另一个导入:其中;导入项目=$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v12.0\WebApplications\Microsoft.WebApplication.targets条件=FALSE/>
- In < PropertyGroup>, add < ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}< /ProjectTypeGuids>
Add another import at the bottom: < Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v12.0\WebApplications\Microsoft.WebApplication.targets" Condition="false" />
当然除去在<额外的空间;标签>,它不是没有张贴他们是正确的。有这个发行与微软在这里电流BUG:的
Of course remove the extra space in the < tags>, it wasnt posting correct without them. There is a current bug issued on this with Microsoft here: https://connect.microsoft.com/VisualStudio/feedback/details/912301/intellisense-for-razor-in-class-libraries-not-working
这篇关于剃刀HTML辅助让步NOP商务部插件智能感知错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!