Nagaraj from my company made this little util recently to run against a compiled assembly and see if it is a Debug or Release version. I added the DOS ErrorLevel return codes.
using System;
using System.IO;
using System.Diagnostics;
using System.Reflection;
namespace Foo.Tools
{
class BuildFind
public static int GetBuildType(string AssemblyName)
Assembly assm = Assembly.LoadFrom(AssemblyName);
object[] attributes = assm.GetCustomAttributes(typeof(DebuggableAttribute), false);
if (attributes.Length == 0)
Console.WriteLine(String.Format("{0} is a RELEASE Build....", AssemblyName));
return 0;
}
foreach (Attribute attr in attributes)
if (attr is DebuggableAttribute)
DebuggableAttribute d = attr as DebuggableAttribute;
Console.WriteLine( String.Format("Run time Optimizer is enabled : {0}", !d.IsJITOptimizerDisabled));
Console.WriteLine( String.Format("Run time Tracking is enabled : {0}", d.IsJITTrackingEnabled));
if (d.IsJITOptimizerDisabled == true)
Console.WriteLine(String.Format("{0} is a DEBUG Build....", AssemblyName));
return 1;
else
return 3;
[STAThread]
static int Main(string[] args)
if (args.Length == 0)
Console.WriteLine("Usage GetBuildType <assemblyName>");
return 2;
return BuildFind.GetBuildType(args[0]);
Ads by The Lounge