Get build configuration string (Debug or Release) at run time

  • Thread starter Thread starter John Williams
  • Start date Start date
J

John Williams

How can I get the build configuration string (Debug or Release) at run
time?

I currently use the following code to get the version number from the
AssemblyInfo.vb AssemblyVersion attribute, and wonder if there is
something similar for getting the build configuration.

Private Function getAppVersion() As String

Dim aName As System.Reflection.AssemblyName

aName = Reflection.Assembly.GetExecutingAssembly().GetName()
getAppVersion = " - Version " + aName.Version.Major.ToString + "." +
aName.Version.Minor.ToString

End Function
 
John,
How can I get the build configuration string (Debug or Release) at run
time?

How about:

Dim config As String = "Release"
#If DEBUG Then
config = "Debug"
#EndIf



Mattias
 
* Mattias Sjögren said:
How about:

Dim config As String = "Release"
#If DEBUG Then
config = "Debug"
#EndIf

.... in the prioject properties, "Configuration settings" -> "Build" the
checkbox "Define DEBUG constant" must be checked.
 
Back
Top