Question

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?

Was it helpful?

Solution

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

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