Determining Configuration at Run-Time

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?
 
G

Gerry O'Brien [MVP]

#If DEBUG Then

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

#End If
 
H

Herfried K. Wagner [MVP]

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.
 
G

Gerry O'Brien [MVP]

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.
 

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