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?
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?
If you have Reflector installed you can also click on the assembly and look for the debuggable attribute ([assembly: Debuggable()]) in the Disassembler pane.
Check this. The idea is that you get the list of assembly attributes using
Assembly.GetCustomAttributes()
and search forDebuggableAttribute
and then find if such attribute hasIsJITTrackingEnabled
property set.I loved that David suggestion, but you could also go this way (
AssemblyInfo.cs
):This is more human friendly, as anyone can right-click that assembly, to select
Properties
and go toDetails
tab.Don't deploy to production via Visual Studio. Look into Continuous Integration and scripted builds (such as with NAnt, or perhaps something more legible like FAKE).
The F5 Key Is Not a Build Process
To detractors who believe that this does not answer the question, the OP wrote:
To guarantee that, use a build server such as TeamCity and possibly a release management tool like Octopus Deploy. Lock down your production systems so that developers must go through the official build process.
If it is your assembly I believe using the AssemblyConfiguration attribute is the best approach. It is documented as "Specifies the build configuration, such as retail or debug, for an assembly."
Depending on your build configurations you might have code like this:
Then check the assembly attribute:
(I know R. Schreurs comment at Rubens Farias says the same, but I've find this information somewhere else before seeing the comment so I believe this requires a more important entry like a full response instead of a comment)
Assuming only Debug and Release configuration, DEBUG symbol is by default defined with Debug configuration, so the code below in AssemblyInfo.cs (under Properties folder).
I use AssemblyTitle over AssemblyDescription as it will show up on my Windows 7 file explorer properties:
For those who like David and stevieg's answer, here is a LINQPad script written in C#. To use the script, you need to download LINQPad 5 and make sure C# Program is selected as shown in screenshot below.
Simply replace DLL_FOLDER_PATH to point to folder containing the DLLs to be inspected.
LINQPAD 5 can be downloaded here.