I have tried the ILMerge MSBuild Task but I get another error which is the following:
Error 1 The "ILMerge.MSBuild.Tasks.ILMerge" task could not be loaded from the assembly ILMerge.MSBuild.Tasks. Could not load file or assembly 'ILMerge, Version=2.8.626.0, Culture=neutral, PublicKeyToken=736440c9b414ea16' or one of its dependencies. Confirm that the declaration is correct, and that the assembly and all its dependencies are available.
That is to say it cannot find the IlMerge, but it is installed. I have put it in the GAC, and no result.
The lines in my csproj are:
<UsingTask TaskName="ILMerge.MSBuild.Tasks.ILMerge" AssemblyName="ILMerge.MSBuild.Tasks" />
<ItemGroup>
<MergeAsm Include="$(OutputPath)$(TargetFileName)" />
<MergeAsm Include="$(OutputPath)xx.dll" />
<MergeAsm Include="$(OutputPath)xxx.dll" />
</ItemGroup>
<Target Name="AfterBuild">
<ILMerge InputAssemblies="@(MergeAsm)" OutputFile="$(OutputPath)nameofproject.exe" TargetKind="SameAsPrimaryAssembly" />
</Target>
I have also tried with this line in a lot of diferent ways:
<UsingTask TaskName="ILMerge.MSBuild.Tasks.ILMerge" AssemblyName="ILMerge.MSBuild.Tasks, Version=1.0.0.0, Culture=neutral, PublicKeyToken=682f805726f4d42e" />
And:
<UsingTask TaskName="ILMerge.MSBuild.Tasks.ILMerge" AssemblyName="g:\Pr\x\xx\ILMerge.MSBuild.Tasks.dll" />
I have put the ilmerge.exe in the same path as the last one. No result.
Please help.
Anyway this will solve the problem that when i build the Setup Project it doesn't merge the dlls?