的Razor视图引擎,如何进入preprocessor(#如果调试) [英] Razor view engine, how to enter preprocessor(#if debug)
本文介绍了的Razor视图引擎,如何进入preprocessor(#如果调试)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
今天我写我的第一页剃须刀,无法弄清楚如何进入#如果调试的#else #ENDIF
I am writing my first razor page today, can't figure out how to enter #if debug #else #endif
我怎么能在剃刀输入preprocessor?
How can i enter preprocessor in razor?
推荐答案
不工作:见下面肖恩的答案
DOES NOT WORK: See Shawn's answer below.
@{
#if DEBUG
// your content
#else
// your content
#endif
}
希望这有助于。
对不起!
这code总是DEBUG。
Sorry! This code always DEBUG.
我错了。
和推荐的模型方法。
如果在只使用网络,引用 <一个href=\"https://msdn.microsoft.com/en-us/library/system.web.httpcontext.isdebuggingenabled%28v=vs.110%29.aspx\">HttpContext.Current.IsDebuggingEnabled属性。
if in use only Web, reference HttpContext.Current.IsDebuggingEnabled property.
这篇关于的Razor视图引擎,如何进入preprocessor(#如果调试)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文