How to check if an assembly was built using Debug or Release configuration?

Check this. The idea is that you get the list of assembly attributes using Assembly.GetCustomAttributes() and search for DebuggableAttribute and then find if such attribute has IsJITTrackingEnabled property set.

    public bool IsAssemblyDebugBuild(Assembly assembly)
    {
        return assembly.GetCustomAttributes(false).OfType<DebuggableAttribute>().Any(da => da.IsJITTrackingEnabled);
    }

Leave a Comment