tags:

views:

39

answers:

2

Hello, I'm using Visual c# Express 2008. I want to have a special command executed just in "Release" builds - this command should not be executed while I'm creating and running Debug versions. Is it possible to implement code depending on my build-type (Debug or. Release)?

For example:

if(??buildtype?? == "Release")
{
 //... special command ...
 MessageBox.Show("RELEASE version");
}
else
{
//... normal command ...
MessageBox.Show("debug release");
}
+5  A: 
#if DEBUG
  // Commands that should run in debug builds.
#else
  // Commands that should run in release builds.
#endif
Max Shawabkeh
do I have to check "Define DEBUG contant" in project properies?
Tobias
+1  A: 

This question also has some useful answers: #ifdef in C#

richj