How can I get the running mode ?

X

xTroLL

Hi,

I want to get the running mode (DEBUG or RELEASE) of my application ? Somebody can help me ?

xTroLL


--------------= Posted using GrabIt =----------------
------= Binary Usenet downloading made easy =---------
-= Get GrabIt for free from http://www.shemes.com/ =-
 
G

Guest

Do you mean pre-compiler directive?

#if (DEBUG)
Log.WriteLine("blah blah blah");
#endif
 
G

Guest

I'm already trying that. But it's not that I want.

In my application, I want to get the type of the compilation use to put it
on a listview

That means : Data application name - Data application value

exemple:
DEBUG - 1.0.882.19234 or RELEASE - 1.0.882.19234

I want that for an About form

PS : Sorry if my english isn't very good
 
N

Nathan Neitzke

xTroll,
If you are still looking for an answer, here it is.

A preprocessor directive is performed by the compiler at compile time. The
following snippet works -

#if DEBUG

Console.WriteLine("Debug Version!");

#else

Console.WriteLine("Release Version!");

#endif



It works because DEBUG is set to true when you compile your app in Debug
mode with VS.NET (think of DEBUG as a variable the compiler uses while
compiling the app. You can define your own compile level variables by the
#define keyword. Such as -

#define pi 3.14

All the compiler does is find all the places where the symbol pi is in your
code (not in string literals though) and replaces it with the literal 3.14.



Hence, DEBUG is replaced with the literal true when compiling in debug mode.



Take care.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top