2

I've been searching a solution to my problem, but all the answers I find don't seem to match my problem. I'm using a ILMerge build script I found by @Contango on this question. It builds and I'm able to use the .exe created just fine.

The problem comes when I try to debug it. When I Debug instead of just building the project I get this error:

Error while trying to run project: Could not load file or assembly 'SpecSheet_Verifier' or on of its dependencies. The located assembly's manifest does not match the assembly reference. (Exception from HRESULT: 0x80131040)

'SpecSheet_Verifier' is the name of my assembly, not a .dll like most of the questions I found were asking about.

So, before I drive myself crazy trying to get this to work I wanted to check if it's even possible to debug the executable I built through ILMerge. If it is, then how would I go about doing that?

The build script I'm using: (Kudos to Contango)

"$(SolutionDir)ILMerge\ILMerge.exe" /out:"$(TargetDir)$(TargetName).all.exe" "$(TargetDir)$(TargetName).exe" "$(TargetDir)*.dll" /target:exe /targetplatform:v4,C:\Windows\Microsoft.NET\Framework64\v4.0 /wildcards
del *.dll
ren "$(TargetDir)$(TargetName).all.pdb" "$(TargetName).all.pdb.temp"
del *.pdb
ren "$(TargetDir)$(TargetName).all.pdb.temp" "$(TargetName).all.pdb"
del "$(TargetDir)$(TargetName).exe"
ren "$(TargetDir)$(TargetName).all.pdb" "$(TargetName).pdb"
ren "$(TargetDir)$(TargetName).all.exe" "$(TargetName).exe"
exit 0
Community
  • 1
  • 1
Natzely
  • 706
  • 2
  • 8
  • 27
  • Could you perhaps side-step the issue by starting the process normally and then attach to it with the debugger? – 500 - Internal Server Error Mar 19 '14 at 17:22
  • @500-InternalServerError Well, I tried to attach after running the .exe and I get an error. "The following module was built either with optimixations enabled or without debug information." I'm running the .exe out of my Debug folder. – Natzely Mar 19 '14 at 19:23
  • Ah, well - I am not personally familiar with ILMerge, but suppose support for merging debug information would be too much to ask for. – 500 - Internal Server Error Mar 19 '14 at 19:34

2 Answers2

1

I had this same error and was able to debug the ILMERGE'd exe by going into the project settings and make sure "Enable the Visual Studio Hosting Process" is UNCHECKED.

jm.
  • 23,422
  • 22
  • 79
  • 93
1

Since this is not marked as the answer I can at least confirm that jm likely saved me hours of pain. Most of the posts I found before this are obsolete or, at best, misleading. Yes you can debug ilmerged modules, just be sure NOT to use \ndebug and handle/copy/rename the generated pdb file appropriately

saminpa
  • 603
  • 1
  • 7
  • 13