Ahmad Hajou
Ahmad Hajou

Reputation: 1319

C# read custom configuration build

In my .net application, I have added new build modes for the configurations.

I currently have: Debug, Release, BetaDebug & BetaRelease. Each having a specific purpose for software engineering purposes.

I wish to know if I can get a C# string containing this text. So I can then do:

string configurationBuild = GetConfigurationBuild();

if(configurationBuild.Contains("Beta") {
    //do something
}
else {
    //do something else
}

Upvotes: 0

Views: 353

Answers (2)

Alexandr Mihalciuc
Alexandr Mihalciuc

Reputation: 2577

You can configure that each configuration will define Conditional Compilation symbols use preprocessor instructions like #if to find out which build configurationis being used. Here is a link on msdn forum http://social.msdn.microsoft.com/Forums/vstudio/en-US/7d574468-c890-49d2-984e-16ad068a006e/build-configuration-in-preprocessor

Upvotes: 1

Related Questions