Partager via


How to differentiate the assembly is debug or release build

From this article https://msdn2.microsoft.com/en-us/library/wx0123s5(VS.80).aspx  , it says that

Debug mode:

 the program is compiled with full symbolic debug information and no optimization.

Optimization complicates debugging, because the relationship between source code and generated instructions is more complex.

Release mode:

The program contains no symbolic debug information and is fully optimized.

Debug information can be generated in PDB Files (C++) depending on the compiler options used.

Creating PDB files can be very useful if you later need to debug your release version.

Info on what is PDB files: https://msdn2.microsoft.com/en-us/library/ms241903(VS.80).aspx

Read this blog, it discusses on How to tell if an existing assembly is Debug or Release build  https://msmvps.com/blogs/bill/archive/2004/06/17/8339.aspx [VB version]

[C# version}
System.Reflection.Assembly asem = Assembly.LoadFile(@"C:\Users\t-pohlim\Desktop\ClassLibrary1\ClassLibrary1\bin\Release\ClassLibrary1.dll");

            foreach (object o in asem.GetCustomAttributes(false))

            {

                if (o is System.Diagnostics.DebuggableAttribute)

                {

                    Console.Write("Is Debug: ");

                    Console.WriteLine(((System.Diagnostics.DebuggableAttribute)o).IsJITTrackingEnabled);

                }

            }

Other alternative, you can read from this blog: https://petesbloggerama.blogspot.com/2006/01/how-to-determine-if-runnina-aspnet-app.html

Comments