如何在C#Visual Studio中定义预处理器符号 [英] How do i define a preprocessor symbols in C# visual studios

查看:252
本文介绍了如何在C#Visual Studio中定义预处理器符号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对不起,如果我的术语错误.我在代码中写了#if TEST_APP.现在,我想定义TEST_APP.如何使用Visual Studios 2010进行设置?这是Windows窗体应用程序.

Sorry if my terminology is wrong. I wrote #if TEST_APP in my code. Now i would like to define TEST_APP. How do i set it using visual studios 2010? This is a windows form application.

如果您能告诉我在Winform项目和Web项目中设置的符号的名称,请奖励

Bonus if you can tell me the name of the symbol that is set in a winform project and in a web project

推荐答案

在Visual Studio解决方案资源管理器中,右键单击一个项目,然后单击属性".打开构建选项卡,您将看到一个字段条件编译符号".这是一个用逗号分隔的列表,或用空格分隔的列表. 常用符号还有两个复选框,即DEBUG和TRACE.

In visual studio solution explorer, right click on a project and click Properties. Open the build tab and you will see a field "Conditional compilation symbols". This is a comma separated list, or space separated. There are also 2 checkboxes for commonly used symbols, DEBUG and TRACE.

对于您的Web项目,您可以将字段设置为"WEB_PROJECT",将winforms设置为"WINFORMS_PROJECT"

For your web projects you could set the field to "WEB_PROJECT" and winforms to "WINFORMS_PROJECT"

这篇关于如何在C#Visual Studio中定义预处理器符号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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