.Net/Winform

C# 디버깅 파일인지 아닌지 체크

동구밖과수원 2012. 8. 10. 22:12
        private bool IsAssemblyDebugBuild(string filepath) 
        {
            return IsAssemblyDebugBuild(System.Reflection.Assembly.LoadFile(System.IO.Path.GetFullPath(filepath))); 
        }
        private bool IsAssemblyDebugBuild(System.Reflection.Assembly assembly) 
        {
            foreach (var attribute in assembly.GetCustomAttributes(false)) 
            {
                var debuggableAttribute = attribute as System.Diagnostics.DebuggableAttribute; 
                if (debuggableAttribute != null) 
                {
                    return debuggableAttribute.IsJITTrackingEnabled;
                } 
            } 
            return false; 
        }