简体   繁体   中英

How to detect debug mode in t4 template?

<#@ template debug="false" hostspecific="True" language="C#" #>

当调试确实为真时,我可能想在输出文件中写入其他行,是否可以以某种方式检测设置调试标志的方式?

How about something like this?

<#@ template debug="false" language="C#" #>
<#@ assembly name="System.Configuration" #>
<#
    #if DEBUG
#>
    I am in debug
<#
    #else
#>
    I am in release
<#
    #endif
#>

For debug="true" you should see "I am in debug", while for debug="false" the output will be "I am in release".

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM