Asp.net core NetCore:name';流行作家';在当前上下文中不存在

Asp.net core NetCore:name';流行作家';在当前上下文中不存在,asp.net-core,.net-standard,razorengine,Asp.net Core,.net Standard,Razorengine,我被RazorEngine.NetCore库的问题缠住了。我在netstandard2.0库中使用它,该库由.NET核心应用程序和.NET 4.7应用程序(FullFramework)使用 对于某些模板,可以,它可以正常工作。但对于某些模板,它在编译模板时开始在生成的类中使用一些方法,如PushWriter和PopWriter IRazorEngineService _razorService = RazorEngineService.Create(new TemplateServiceConf

我被RazorEngine.NetCore库的问题缠住了。我在netstandard2.0库中使用它,该库由.NET核心应用程序和.NET 4.7应用程序(FullFramework)使用

对于某些模板,可以,它可以正常工作。但对于某些模板,它在编译模板时开始在生成的类中使用一些方法,如PushWriter和PopWriter

IRazorEngineService _razorService = RazorEngineService.Create(new TemplateServiceConfiguration()
        {
            ReferenceResolver = new MyIReferenceResolver(), 
            Debug = true,
            EncodedStringFactory = new RawStringFactory(),
            BaseTemplateType = typeof(CustomTemplateBase<>)
        });
但当它击中编译方法时,我得到了以下错误:

Errors while compiling a Template.
Please try the following to solve the situation:
  * If the problem is about missing/invalid references or multiple defines either try to load 
    the missing references manually (in the compiling appdomain!) or
    Specify your references manually by providing your own IReferenceResolver implementation.
    See https://antaris.github.io/RazorEngine/ReferenceResolver.html for details.
    Currently all references have to be available as files!
  * If you get 'class' does not contain a definition for 'member': 
        try another modelType (for example 'null' to make the model dynamic).
        NOTE: You CANNOT use typeof(dynamic) to make the model dynamic!
    Or try to use static instead of anonymous/dynamic types.
More details about the error:
 - error: (111, 16) The name 'PushWriter' does not exist in the current context
     - error: (115, 258) The name 'PopWriter' does not exist in the current context
     - error: (131, 16) The name 'PushWriter' does not exist in the current context
     - error: (138, 41) The name 'PopWriter' does not exist in the current context
     - error: (150, 16) The name 'PushWriter' does not exist in the current context
     - error: (152, 277) The name 'PopWriter' does not exist in the current context
     - error: (200, 16) The name 'PushWriter' does not exist in the current context
     - error: (202, 261) The name 'PopWriter' does not exist in the current context
     - error: (413, 16) The name 'PushWriter' does not exist in the current context
     - error: (415, 224) The name 'PopWriter' does not exist in the current context
     - error: (468, 16) The name 'PushWriter' does not exist in the current context
     - error: (470, 277) The name 'PopWriter' does not exist in the current context
     - warning: (102, 8) The variable 'sector' is assigned but its value is never used
Temporary files of the compilation can be found in (please delete the folder): C:\[folder-structure-hidden]\RazorEngine_kg4royrl.trc
The template we tried to compile is: 
我将Microsoft.AspNetCore.Mvc和Microsoft.AspNetCore.Mvc.Razor添加到项目引用和MyIReferenceResolver中,但没有成功

我可以在Roslyn生成的异常中看到生成的部分代码如下所示:

BeginWriteAttribute("style", " style=\"", 8783, "\"", 8878, 3);
            WriteAttributeValue("", 8791, "min-width:100%;", 8791, 15, true);
            WriteAttributeValue(" ", 8806, new Microsoft.AspNetCore.Mvc.Razor.HelperResult(async(__razor_attribute_value_writer) => {
                PushWriter(__razor_attribute_value_writer);
                                                                                                                                                                                                if (f.Something) {WriteLiteral("border-right: 1px solid #dddddd;");
                                                                                                                                                                                                                                                                    }PopWriter();
            }
            ), 8807, 70, false);
以前有人经历过吗


谢谢大家!

你解决了吗?你解决了吗?
BeginWriteAttribute("style", " style=\"", 8783, "\"", 8878, 3);
            WriteAttributeValue("", 8791, "min-width:100%;", 8791, 15, true);
            WriteAttributeValue(" ", 8806, new Microsoft.AspNetCore.Mvc.Razor.HelperResult(async(__razor_attribute_value_writer) => {
                PushWriter(__razor_attribute_value_writer);
                                                                                                                                                                                                if (f.Something) {WriteLiteral("border-right: 1px solid #dddddd;");
                                                                                                                                                                                                                                                                    }PopWriter();
            }
            ), 8807, 70, false);