Question

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
Was it helpful?

Solution

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.

OTHER TIPS

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top