我如何在 C# 视觉工作室中定义预处理器符号 [英] How do i define a preprocessor symbols in C# visual studios

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

问题描述

抱歉,如果我的术语有误.我在代码中写了 #if TEST_APP.现在我想定义 TEST_APP.我如何使用 Visual Studios 2010 设置它?这是一个窗体应用程序.

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 解决方案资源管理器中,右键单击一个项目,然后单击属性".打开构建选项卡,您将看到一个字段条件编译符号".这是一个逗号分隔的列表,或空格分隔.常用符号还有 2 个复选框,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_PROJECT"并将 winforms 设置为WINFORMS_PROJECT"

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

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

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