ILRepack.FullAuto icon indicating copy to clipboard operation
ILRepack.FullAuto copied to clipboard

How to merge just one assembly?

Open FLAMESpl opened this issue 2 years ago • 6 comments

I need to merge just one assembly, ILRepackInputAssemblies property does nothing and I do not want to go through each of my dependencies to exclude them. Is it possible?

FLAMESpl avatar Apr 19 '24 14:04 FLAMESpl

Hi,

The symbol ILRepackInputAssemblies is not referred in ILRepack.FullAuto package. It is simple to use:

  1. Install the ILRepack.FullAuto NuGet package.
  2. If there are assemblies you do not want to merge, list the assembly names in the ILRepackExcludeAssemblies property. All other managed assemblies will be automatically merged.

Perhaps you have other detailed requirements, specify each other optional property.

All of these will be passed on to official ILRepack executable options for processing. Since the processing and manipulation of the assembly itself is not done by ILRepack.FullAuto, there may be some things that cannot be merged due to ILRepack's constraints.

Is this what you wanted to know?

kekyo avatar Apr 20 '24 02:04 kekyo

Is there a way to programatically build ILRepackExcludeAssemblies collection that would have all dependent assemblies except for one I want to merge? I do not want to everyone remember that they need to extend hardocded collection of excludes whenever they add a new dependecny to the project.

I could use other ILRepack wrapper, but ILRepack.FullAuto seems to be the only option to run ILRepack using CLRCore toolchain instead of mono on linux.

FLAMESpl avatar Apr 20 '24 12:04 FLAMESpl

Understood. So you are saying you want to specify the assemblies to be combined in a whitelist way? This is not possible with the current ILRepack.FullAuto, but will be considered in future improvements.

kekyo avatar Apr 22 '24 08:04 kekyo

@FLAMESpl @kekyo I also found this missing functionality. Wrote a simple workaround for me:

    <Target Name="BeforeILRepackPrepareBuild" BeforeTargets="ILRepackPrepareBuild">
      <ItemGroup>
        <_ILRepackIncludeAssemblies_Items Include="$(OutputPath)SingleAssemblyToInclude.dll"/>
        <_ILRepackExcludeAssemblies_Items Include="$(OutputPath)*.dll" Exclude="@(_ILRepackIncludeAssemblies_Items)"/>
      </ItemGroup>
      <PropertyGroup>
        <ILRepackExcludeAssemblies>@(_ILRepackExcludeAssemblies_Items)</ILRepackExcludeAssemblies>
      </PropertyGroup>
    </Target>

maxkatz6 avatar Aug 06 '24 22:08 maxkatz6

I see, I'm not sure if ILRepack is equivalent to the process of excluding internally, but it seems to serve the purpose in a general way. Thanks for the info!

kekyo avatar Aug 08 '24 08:08 kekyo