Соеденить все managed (!) dll в одну dll/exe можно с помощью ILRepack.
ILMerge мертв, его заменил
ILRepack.
Сборку можно делать Post Build Event проекта вызовом ILRepack.exe на результатам сборки.
<Target Name="Repack" AfterTargets="BuiltProjectOutputGroup">
<GetFrameworkPath>
<Output TaskParameter="Path" PropertyName="FrameworkPath" />
</GetFrameworkPath>
<ItemGroup>
<NetPlatformFolders Include="$(NuGetPackageFolders.Split(';'))"></NetPlatformFolders>
</ItemGroup>
<ItemGroup>
<AllowDup Include="System.%2A" />
<AllowDup Include="JetBrains.%2A" />
</ItemGroup>
<ItemGroup>
<RapackTarget Include="$(TargetDir)MyDll1.dll" />
<RapackTarget Include="$(TargetDir)MuDll2.dll" />
</ItemGroup>
<PropertyGroup>
<ILRepack Condition="'$(ILRepack)' == ''">$(NuGetPackageRoot)ilrepack\2.1.0-beta1\tools\ILRepack.exe</ILRepack>
<ILRepackTargetPlatform Condition="'$(TargetFramework)' == 'net45'">v4,$(FrameworkPath)</ILRepackTargetPlatform>
<ILRepackTargetPlatform Condition="'$(TargetFramework)' == 'netstandard1.3' or '$(TargetFramework)' == 'netcoreapp2.0' or '$(TargetFramework)' == 'netstandard2.0'">v4</ILRepackTargetPlatform>
<IlRepackLibs Condition="'$(TargetFramework)' == 'netstandard2.0'">@(NetPlatformFolders->'"/lib:%(FullPath)\netstandard.library\2.0.0\build\netstandard2.0\ref"', ' ')</IlRepackLibs>
<IlRepackLibs Condition="'$(TargetFramework)' == 'netcoreapp2.0'">@(NetPlatformFolders->'"/lib:%(FullPath)\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0"', ' ')</IlRepackLibs>
<IlRepackAllowDup>@(AllowDup->'"/allowdup:%(Identity)"', ' ')</IlRepackAllowDup>
<IlRepackTargets>@(RapackTarget->'"%(Identity)"', ' ')</IlRepackTargets>
</PropertyGroup>
<Exec Command="$(mono) "$(ILRepack)" /target:exe "/targetplatform:$(ILRepackTargetPlatform)" /union /parallel /internalize "/lib:$(TargetDir.TrimEnd('\'))" $(IlRepackLibs) $(IlRepackAllowDup) "/out:$(TargetPath)" "$(TargetPath)" $(IlRepackTargets)" WorkingDirectory="$(SolutionDir)" />
<Delete Files="@(RapackTarget);" />
</Target>
Конечно надо всё настраивать.