使用新命名空间的razor页面中的@在azure

时间:2017-05-21 19:55:48

标签: azure asp.net-core

在我的电脑和视觉工作室2017上。 当我添加一个带有新命名空间的html帮助器并将其导入我的ViewImports并运行时,没有错误消息,我可以使用HtmlHelper。 但是当我在azure上使用VSTS发布时,会出现错误消息:

    One or more compilation failures occurred:
 /Views/_ViewImports.cshtml(7,12): error CS0234: The type or namespace name 'TagHelpers' does not exist in the namespace 'Anna' (are you missing an assembly reference?)

我的助手代码:

namespace Anna.TagHelpers
{
    public static class IsActiveHelpersExtension
    {
        public static HtmlString IsActive(this IHtmlHelper helper, int nbAppels, int currentNbAppel)
        {
            if (nbAppels == currentNbAppel)
                return new HtmlString("class=\"active\"");
            else
                return new HtmlString(string.Empty);
        }
    }
}

My ViewImports:

@using Anna
@using Anna.Models
@using Anna.Models.AccountViewModels
@using Anna.Models.ManageViewModels
@using Microsoft.AspNetCore.Identity
@using Microsoft.AspNetCore.Html
@using Anna.TagHelpers
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
@inject Microsoft.ApplicationInsights.Extensibility.TelemetryConfiguration TelemetryConfiguration
@inject Microsoft.ApplicationInsights.AspNetCore.JavaScriptSnippet JavaScriptSnippet

我不明白我的电脑和天蓝色应用程序服务有什么不同。

0 个答案:

没有答案