检测从调试版本发布版本的最好方法? 。净 [英] Best way to detect a release build from a debug build? .net

查看:195
本文介绍了检测从调试版本发布版本的最好方法? 。净的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以,我有我与MVC应用程序使用约10个短css文件。 还有像 error.css login.css 等等... 使更新和编辑很容易(至少对我)只是一些很短的css文件。我要的是什么,将优化的if else分支,而不是在最后一位将其合并。我想要做这样的事情

So I have about 10 short css files that I use with mvc app. There are like error.css login.css etc... Just some really short css files that make updating and editing easy (At least for me). What I want is something that will optimize the if else branch and not incorporate it within the final bits. I want to do something like this

if(Debug.Mode){

<link rel="stylesheet" type="text/css" href="error.css" /> 
<link rel="stylesheet" type="text/css" href="login.css" /> 
<link rel="stylesheet" type="text/css" href="menu.css" /> 
<link rel="stylesheet" type="text/css" href="page.css" /> 
} else {
<link rel="stylesheet" type="text/css" href="site.css" /> 
}

我有一个MSBuild任务将合并所有的css文件,尽量减少他们和所有的好东西。我只需要知道,如果有一种方法来去除,如果else分支的最后位。

I'll have a msbuild task that will combine all the css files, minimize them and all that good stuff. I just need to know if there is a way to remove the if else branch in the final bits.

推荐答案

具体地讲,像这样在C#:<​​/ P>

Specifically, like this in C#:

#if (DEBUG)
   Debug Stuff
#endif

C#有以下preprocessor指令:

C# has the following preprocessor directives:

#if 
#else 
#elif // Else If
#endif
#define
#undef // Undefine
#warning // Causes the preprocessor to fire warning
#error // Causes the preprocessor to fire a fatal error
#line // Lets the preprocessor know where this source line came from
#region // Codefolding
#endregion

这篇关于检测从调试版本发布版本的最好方法? 。净的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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