Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to merge pdb files with ilmerge?

Tags:

c#

.net

ilmerge

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?

like image 537
Patrick Avatar asked Sep 17 '09 15:09

Patrick


1 Answers

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

like image 133
Tito Avatar answered Sep 23 '22 02:09

Tito