Trying to define a preprocessor directives in the Visual studio 2012.
#define FLAG
....
#endif
But not sure, where to include this FLAG
in visual studio - C#. I remember specifying something like this in C++ projects.
Any thoughts ?
You have two options as to where to define it:
Code file level - In the beginning of the file write #define FLAG
. You cannot place anything else (other than comments and blank lines) before define
directives. As Ron Beyer points out, a directive defined in a file exists only for that file.
Project level - Right click in the project in Solution Explorer, select Properties
, then the Build
tab, then look at Conditional compilation symbols
. Then one can define several comma-separated symbols there such as: FLAG,FOO,BAR
. Note that this symbols list is project configuration dependent (there is a configuration selector in the same tab).
Note as mentioned in the comments, define
does not work in C# the same way that it does in C. In C# you just declare that the symbol exists, but you can't assign a value to it. Hence the only use for these symbols is for #if FLAG
directives and for the Conditional attribute.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With