kekyo / ILRepack.FullAuto

Full automatic ILRepack executor on .NET, .NET Core and .NET Framework environments.
MIT License
20 stars 1 forks source link

How to merge just one assembly? #12

Open FLAMESpl opened 6 months ago

FLAMESpl commented 6 months ago

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?

kekyo commented 6 months ago

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?

FLAMESpl commented 6 months ago

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.

kekyo commented 6 months ago

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.

maxkatz6 commented 2 months ago

@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>
kekyo commented 2 months ago

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!