Razor HTML Helpers giving intellisense errors in Nop Commerce plugin

I am writing a plugin for Nop Commerce and my HTML helpers give me intellisense errors. I get red lines underlining them and errors:

The extension method function cannot be used because it is not part of the ISO-2 C # language specification

The lambda expression function cannot be used because it is not part of the C # ISO-2 language specification

Here is my code:

@{
    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 this:

enter image description here

I was looking for hours of response, but could not find what really works. The project is a code library and is located on ASP.NET 4.5.1, like all other solutions. There are no errors when building. Am I missing a link or instruction? I'm not sure what is going on.

+4
3

( VS2013) - MVC:

+3

MVC , VS2013 4.

:

  • Build, Output, Output Path bin\, ..\..\Presentation\Nop.Web\Plugins\PLUGINNAMESPACE.PLUGINNAME\, nopCommerce.

    .csproj :

    <OutputPath>bin\</OutputPath>
    
  • , Post-build:, nopCommerce.

    (robocopy $(ProjectDir)$(OutDir) $(ProjectDir)..\..\Presentation\Nop.Web\Plugins\PLUGINNAMESPACE.PLUGINNAME\ /MIR) ^& IF %ERRORLEVEL% LEQ 1 exit 0
    

    .csproj :

    <PropertyGroup>
        <PostBuildEvent>(robocopy $(ProjectDir)$(OutDir)  $(ProjectDir)..\..\Presentation\Nop.Web\Plugins\PLUGINNAMESPACE.PLUGINNAME\ /MIR)  ^&amp; IF %25ERRORLEVEL%25 LEQ 1 exit 0</PostBuildEvent>
    </PropertyGroup>
    
  • . post-build: "".

    .csproj :

    <PropertyGroup>
        <RunPostBuildEvent>Always</RunPostBuildEvent>
    </PropertyGroup>
    
  • , DLL . ProjectReference, Nop.Core, Nop.Data .. , , nopCommerce, Intellisense.

    .csproj :

    <Reference Include="System.Web">
        <Private>True</Private>
    </Reference>
    
    (repeat for all DLL file references)...
    
  • , razor.cshtml. Intellisense , - .

+2

The project must know it in plugin development

1: Close your solution 2: open the * .csproj file with any editor 3: Add the following to the end of the project close tag

<Import Project="$(SolutionDir)\FixRazorIntellisense.targets" Condition="'$(Configuration)' == 'PluginDev'" />

4: reload solution / project

0
source

Source: https://habr.com/ru/post/1544255/


All Articles