Does anyone know how to get the current build configuration $(Configuration) in C# code?
Does anyone know how to get the current build configuration $(Configuration) in C# code?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Update
Egors answer to this question ( here in this answer list) is the correct answer.
You can’t, not really.What you can do is define some "Conditional Compilation Symbols", if you look at the "Build" page of you project settings, you can set these there, so you can write #if statements to test them.
A DEBUG symbol is automatically injected (by default, this can be switched off) for debug builds.
So you can write code like this
However, don’t do this unless you’ve good reason. An application that works with different behavior between debug and release builds is no good to anyone.