3
votes

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.

1
Perhaps you would be better off looking for help around working with MSBuild tasks (which is what ILMerge-Tasks is) and TFS.Tim Lloyd
Does the AssemblhyFile require the full file name and not the assembly namespace?kenny
I've tried using the actual assembly file name ILMerge.MSBuild.Task.dll, but I still got the same errorDidaxis

1 Answers

4
votes

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