I had to figure this out a couple days ago and the answer isn't what you'd expect: It's not FileVersionInfo.IsDebug or IsRelease, as neither compiler flips the required bit. As far as I can tell, the only way is to look for a DebuggableAttribute on the assembly.
static void Main(string[] args)
{
Assembly assm = Assembly.LoadFrom(args[0]);
bool found = assm.GetCustomAttributes(typeof(DebuggableAttribute), false).Length > 0;
Console.WriteLine("Assembly is {0}.", found ? "debug" : "release");
}