RazorGenerator can't see custom cshtml helper

前端 未结 5 2155
小鲜肉
小鲜肉 2021-02-12 20:06

I\'m having a problem with RazorGenerator: it can\'t compile views that uses my custom helper:

App_Code/ViewHelper.cshtml

@helper test(System.Web.Mvc.Ht         


        
5条回答
  •  日久生厌
    2021-02-12 21:05

    I'm using RazorGenerator.MsBuild to compile my views and RazorGenerator.Mvc to load them. The easiest App_Code fix for me was to add the following to the top of my helper files

    @*
    Generator: MvcHelper
    GeneratePrettyNames: true
    Namespace: My.Projects.Namespace
    *@
    

    With this there's no web.config changes or anything else that needed to be made.

提交回复
热议问题