Skip to content

How to link only specific assemblies? #2981

@rolfbjarne

Description

@rolfbjarne

This is related to the change to have TrimMode use two new values: full and partial: #2856

There doesn't seem to be an obvious way to only trim specific assemblies anymore.

Previously this could be accomplished by setting TrimMode=copy in the project file, and then selectively change the trim mode for the assemblies I'd like to be trimmed.

If I keep doing this, all assemblies that has opted in to trimmed will be copied, and all assemblies that have not opted in to trimming will be trimmed... which seems quite backwards. Looking at the source code it seems it would work to set _TrimmerDefaultAction=copy to have the assemblies that have not opted in to trimming be copied, but this doesn't seem like the right solution.

Example binlog: build-Mac-20220818_110527.binlog.zip

This project sets TrimMode=copy, but looking at the linker diagnostics some assemblies are linked:

    ILLink: Output action: '    Link' assembly: 'nunit.framework, Version=3.12.0.0, Culture=neutral, PublicKeyToken=2638cd05610744eb'.
    ILLink: Output action: '    Link' assembly: 'trimmode copy, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.
    ILLink: Output action: '    Link' assembly: 'nunitlite, Version=3.12.0.0, Culture=neutral, PublicKeyToken=2638cd05610744eb'.
    ILLink: Output action: '    Save' assembly: 'BundledResources, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.
    ILLink: Output action: '    Link' assembly: 'Touch.Client, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.

CC @agocke

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions