Created
September 26, 2016 22:58
-
-
Save nbxx/164ee9f80ff7c3a2f6c23370a4016bb0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
namespace ConsoleApplication4 | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
// Want to detect which build is used | |
Console.WriteLine(BuildConfiguration.IsDebug ? "Debug" : "Release"); | |
} | |
public static class BuildConfiguration | |
{ | |
/// <summary> | |
/// Gets a value indicating whether the assembly was built in debug mode. | |
/// </summary> | |
public static bool IsDebug | |
{ | |
get | |
{ | |
bool isDebug = true; | |
#if !DEBUG | |
isDebug = false; | |
#endif | |
return isDebug; | |
} | |
} | |
/// <summary> | |
/// Gets a value indicating whether the assembly was built in release mode. | |
/// </summary> | |
public static bool IsRelease | |
{ | |
get | |
{ | |
return !IsDebug; | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment