Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ILMerge question

I'm trying to merge multiple assemblies into one as my 'Proxy' assembly for a WCF service. Currently, users of the Proxy need to reference the assembly containing the data contracts, and also my domain assembly because of my inheritance schemes.

I'd like to use ILMerge for this. In particular, the ILMerge-Tasks project looks promising, especially this line from their project home:

ILMerge-Tasks Project Home:

...It even includes a post-build event that merges ILMerge and the task dll so that you can use the task without ILMerge.exe being present.

This is precisely what i'd like to accomplish, but i really have no idea how to go about it. Please help!

Other relevant (perhaps) info:

  • We are using automated builds in TFS, so not having ilmerge.exe present will be a big plus

Update:

So I included the ILMerge.MSBUild.Tasks.dll in my project and added the following to my build file (taken from ilmerge project home):

<Target Name="AfterBuild">

    <UsingTask TaskName="ILMerge.MSBuild.Tasks.ILMerge" 
        AssemblyFile="ILMerge.MSBuild.Tasks.ILMerge"/>
    <ItemGroup>
       <MergeAsm Include="BarProject.dll" />
       <MergeAsm Include="FooProject.dll" />
    </ItemGroup>

    <ILMerge InputAssemblies="@(MergeAsm)" OutputFile="FooBar.dll" />
</Target>

But now I get the following error:

The "UsingTask" task was not found. Check the following: 1.) The name of the task in the project file is the same as the name of the task class. 2.) The task class is "public" and implements the Microsoft.Build.Framework.ITask interface. 3.) The task is correctly declared with in the project file, or in the *.tasks files located in the "C:\Windows\Microsoft.NET\Framework\v4.0.30319" directory.

like image 607
Didaxis Avatar asked Feb 15 '26 08:02

Didaxis


1 Answers

Solved.

  • I did NOT use the configuration above
  • I did NOT use the ILMerge.MSBuild.Tasks.dll

Here's the steps I took:

  • Added a reference to ILMerge.exe (the one from Microsoft Research) to my project
  • Added this PostBuild entry to my MSBuild file (.csproj):

    ILMerge /out:FooBar.dll Bar.dll Foo.dll

like image 175
Didaxis Avatar answered Feb 17 '26 22:02

Didaxis



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!