How to programmatically figure out the ConfigurationName that the project was built with

I have a windows form project in a solution and when I run that project (whether its via the IDE or running the .exe), I want to be able to know the ConfigurationName that the exe/project was built with.  I've looked everywhere and it seems that I need to use DTE or VSLangProj objects to get this, but I can't figure out how to use them to do what I want to do.

In my MDI, I want to have an if statement similar to this:
If Project.ConfigurationName = "Release" then
     statement 1
     statement 2
End if

can anyone help?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jorge PaulinoIT Pro/DeveloperCommented:
Hi ablesa,

Try this:


ablesaAuthor Commented:
thanks, but no....that's the name of my assembly....
ablesaAuthor Commented:
no resolution.
Joseph2002Embedded EngineerCommented:
Try this. Check the "define DEBUG constant" in the "Advanced Compiler Settings" of your Debug Project only. Then use the following in your code:

#If Not DEBUG Then
     statement 1
     statement 2
#End If

the two statements will only be executed for the RELEASE version of you program.
Take care.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ablesaAuthor Commented:
Thanks, Joseph!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.