首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

关于CodeSmith的转义,该怎么处理

2012-02-01 
关于CodeSmith的转义我用CodeSmith生成ASPX页面,遇到了字符转义问题,请会的兄弟帮一下大家都知道CodeSmith

关于CodeSmith的转义
我用CodeSmith生成ASPX页面,遇到了字符转义问题,请会的兄弟帮一下
大家都知道CodeSmith的变量用 <%=XXX%> 这样的定义的,但ASPX的绑定语法也是类似
<%#   Bind( "XXX ")...,这样就和CodeSmith冲突了
还有在生成C#代码的时候和类似IView < <%=XXX%> > 这样的代码冲突,CodeSmith不认识 < <%字符,请问大家是如何解决此类问题的?

[解决办法]
IView < <%=XXX%> >
我都是这样写的
[解决办法]
按照帮助里面的说法,

Q: I am generating ASP.NET code from my templates and the ASP.NET tags are causing CodeSmith to get confused.



A: Change the ASP.NET tags to <%% instead of <%, this will escape the tag and allow it to be passed down to the output of the template instead of being processed as template code.

就是你所有的ASP.NET的标签都要写成 <%%开头,而CodeSmith变量用 <%开头,这样就不冲突了。

热点排行