1

I have a number of DLLs that are merged using the ILMERGE.EXE tool from Microsoft. All the DLLs have 'optimize my code' unchecked.

When trying to debug code in a web application the modules screen (in Visual Studio) shows the dll has been optimized. This obviously causes a problem when trying to debug certain parts of the application.

Is there a way of building a DLL using ILMERGE which does not optimize the code?

GEOCHET
  • 21,119
  • 15
  • 74
  • 98
gary
  • 624
  • 6
  • 10

2 Answers2

2

Add the /copyattrs-Attribute to the ILMERGE command line.

hofingerandi
  • 517
  • 4
  • 20
  • Thank you so much for this answer - you saved us a boatload of time! Basically, we had a ILMERGE being done on a project that was referenced by another project in the solution. We could still 'Step Into' the code for the first project, but we couldn't examine any of the contents of the variables. This /copyattrs made it so that we could! :-) – Kevin Feb 06 '20 at 19:00
1

ILMerge has an option to merge PDBs if you use it, you will be able to debug through your code.

See this blog post and discussion on Scott Hanselman's blog

Also see ILMerge Gui for a UI that has this integrated

Sam Saffron
  • 128,308
  • 78
  • 326
  • 506
  • However, it doesn't solve the problem. The IL Merge is producing the PDB by default, however some of the methods within it are still being optimized when built on the web application (whilst some are not). – gary Jan 21 '09 at 03:24
  • What happens when you build in debug mode and then merge, if its unmerged are you having any issues debugging? – Sam Saffron Jan 21 '09 at 04:26