.netdllrelease-modedebug-mode

Is it possible to convert a debug assembly into a release assembly?


Given a source assembly (dll) that is in debug mode, is there a way to generate a release mode assembly?

Note: This question stems from the need to deploy a dll to production in release mode for a dll in which we no longer have the source code, just a dll in debug mode.


Solution

  • Short answer to your direct question is "no." This is because there may be #if DEBUGs in the original C# code that are no longer present in the compiled MSIL.

    Long answer part A) for the most part, it shouldn't matter a whole lot, certainly not to the degree is does with C or C++ where there are different run-time libraries for debug vs. release. Perhaps the biggest downside is that you'd be missing release optimization (and/or the overhead of extra debug-only code).

    Longer answer part B) if you really needed something in release mode (e.g., for optimization), you could try using a decompiler to get some C# code back and re-compile that in release mode.