ASP.NET RazorGenerator" WriteAttribute"没有被定义 [英] ASP.NET RazorGenerator "WriteAttribute" is not defined

查看:169
本文介绍了ASP.NET RazorGenerator" WriteAttribute"没有被定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用RazorGenerator https://github.com/RazorGenerator/RazorGenerator 外包我的菜单一个DLL文件,这样我可以在multiplice项目共享。在这些意见我有一个foreach循环应该产生这样的列表:

I'm using RazorGenerator https://github.com/RazorGenerator/RazorGenerator to outsource my menu to a DLL file so that I can share it across multiplice projects. In those views I've a foreach loop which should generate a list like this:

@foreach (var myItem in MyClass.Instance.Elements) {
    <li>
        <img src="@myItem.Icon" />
    </li>
}

但我不能编译它们:这是由RazorGenerator生成MyView.generated.cs文件创建img标签下面一行:

But I can't compile them: The MyView.generated.cs file which is generated by RazorGenerator is creating the following line for the img tag:

WriteAttribute("src", Tuple.Create(" src=\"", 1038), Tuple.Create("\"", 1057)

下面是问题,因为我得到了'WriteAttribute'没有定义的错误。我无法找到有关此方法的许多信息,好像这是从RazorGenerator的方法。

Here is the problem because I got an error that 'WriteAttribute' is not defined. I can't find many information about this method, seems like that this is a method from RazorGenerator.

但奇怪的是,我在一个testproject测试相同code之前,因为这是我第一次使用RazorGenerator。目前它与同一回路,但我无法找到任何差异。这两个项目有相同的版本相同的参考和大会的也。我ONY发现,WriteAttribute()从WebPageExecutionBase来了。

The strange thing is that I tested the same code before in a testproject because it's the first time I'm using RazorGenerator. There it works with the same loop but I can't find out any differences. Both projects have the same references and assemblys also in the same version. I ony found out that WriteAttribute() came from WebPageExecutionBase.

我该如何解决这个问题?

How can I fix the issue?

推荐答案

不要设置的建议上面的本地副本将不会产生正确的generated.cs文件生成操作无法比拟的。

Don't set the Build Action to none as suggested above as your local copy will not generate the correct generated.cs file.

这篇关于ASP.NET RazorGenerator&QUOT; WriteAttribute&QUOT;没有被定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆