I'm starting deployment of my web application and I need to guarantee that all the assemblies that are going to be deployed were built using Release configuration. Our system was developed using C#/.Net 3.5.
Is there any way to achieve this?
Check your project's build settings under 'Apple LLVM - Preprocessing', 'Preprocessor Macros' for debug to ensure that DEBUG is being set - do this by selecting the project and clicking on the build settings tab. Search for DEBUG and look to see if indeed DEBUG is being set.
A Debug configuration supports the debugging of an app, and a Release configuration builds a version of the app that can be deployed.
dll with vcruntime140. dll and ucrtbase. dll, then they were built for release. One other thing that you could look out for is that if you built them with the debug symbols enabled then the debug directory will contain the path to the debug symbol file (even with release builds).
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); }
I loved that David suggestion, but you could also go this way (AssemblyInfo.cs
):
#if DEBUG [assembly: AssemblyDescription("Your application assembly (DEBUG version)")] #else if RELEASE [assembly: AssemblyDescription("Your application assembly (RELEASE version)")] #endif
This is more human friendly, as anyone can right-click that assembly, to select Properties
and go to Details
tab.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With