Determining Configuration at Run-Time

  • Thread starter Thread starter Jeff Stewart
  • Start date Start date
J

Jeff Stewart

How can I determine, at run-time, what configuration the .exe was
built with? I'd like to know when an .exe I'm running is a debug vs.
a release build, preferably with something like " - DEBUG" appended to
the app's name in the title bar.

If it can't be done at run-time, are there any compile-time directives
that could accomplish the same effect?
 
#If DEBUG Then

set what you want in here. Will only be available if the build is debug.

#End If
 
Gerry,

Gerry O'Brien said:
#If DEBUG Then

set what you want in here. Will only be available if the build is debug.

#End If

ACK.

In order to make this work, in the project properties, "Configuration
settings" -> "Build" the
checkbox "Define DEBUG constant" must be checked.
 
Hmmm, is that on by default?

I am not at my VS computer right now but I know that I did not check that
item on my development machine at work and I verified it by running this
code on that machine.

I will have to check tomorrow to see if that is checked. I know I have not
set that option myself.
 
Back
Top