tags:

views:

598

answers:

2

For various reasons we use ilmerge to put all of our application assemblies into one file so the user needs to handle just one file. Unfortunately it seems that there is no way to merge the .pdb files with the assemblies. Anyone knows a way to work around that?

+1  A: 

You can have it merge them for you using the /ndebug flag on the command.

This article explains more.

Mitchel Sellers
Thanks for the info. For some reason the switch just keeps ilmerge from producing a pdb file in addition to the merged assembly but doesn't put the info into the merged assembly. I'll post an update when I find out what's going wrong.
longeasy
I am having the same problem as @longeasy. /ndebug doesn't help at all.
Konstantin Spirin
/ndebug will merge several pdb's into one, just as with the assemblies. The question is how to merge the assemblies with the pdb files, so it is all one single file.
Lucas
Isn't `/ndebug` the switch for _not_ merging pdb-files?
Bobby
+7  A: 

Ok, I figured this one out, though it took a while.

That article has /ndebug exactly backwards.

From the release notes that come with ILMerge (ILMerge.doc, emphasis mine):

2.8 DebugInfo public bool DebugInfo { get; set; } When this is set to true, ILMerge creates a .pdb file for the output assembly and merges into it any .pdb files found for input assemblies. If you do not want a .pdb file created for the output assembly, either set this property to false or else specify the /ndebug option at the command line. Default: true Command line option: /ndebug

The solution is specifically to not have that flag on your command line. ILMerge will merge pdb files by default. Make sure that all of the pdb files of your source assemblies are in the same directory, along side their associated dlls, so that ILMerge can find them. (We are using project references and have one ILMerge project, which takes care of this requirement.)

Here is the relevant section from my ILMerge csproj file.

 <Target Name="AfterBuild">
    <CreateItem Include="@(ReferencePath)" Condition="'%(CopyLocal)'=='true'">
      <Output TaskParameter="Include" ItemName="IlmergeAssemblies" />
    </CreateItem>
    <Exec Command="&quot;..\..\Libraries\Ilmerge.exe&quot; /copyattrs /allowMultiple /out:&quot;@(MainAssembly)&quot; &quot;@(IntermediateAssembly)&quot; @(IlmergeAssemblies->'&quot;%(FullPath)&quot;', ' ')" />
    <Delete Files="@(ReferenceCopyLocalPaths->'$(OutDir)%(DestinationSubDirectory)%(Filename)%(Extension)')" />
  </Target>

For completeness, I am using the latest version of ilmerge.exe: Version 2.10.219.0, with a last modified date of 2/19/2010 9:49 AM

Tito