Skip to content

dotnet/linker

main
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

The ILLink analyzer testcase generator was generating extra
testcases in dotnet/runtime, compared to linker. It turned out
that in dotnet/linker, testcases with non-public Main methods
were not getting generated, because the generator was getting a
reference assembly for Mono.Linker.Tests.Cases.dll (which doesn't
contain the non-public entry point), whereas dotnet/runtime has
ref assembly generation turned off (so the analyzer was correctly
discovering testcases based on the implementation assembly).

This fixes the issue by turning off ref assembly generation for
all projects except those specifically designed to be ref
assemblies.

The CompilerGeneratedCodeSubstitutions is disabled because it is
not supported by the analyzer.
c9ba21d

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
Nov 8, 2022
Nov 11, 2021

Trimming Tools

This repository hosts various tools and msbuild tasks which are used when trimming managed applications with .NET 5 and newer.

IL Trimmer

The IL Trimmer is the developer's tool that can be used to produce apps that contain only code and assembly dependencies which are necessary to run the app. It's fully integrated into .NET SDKs via ILLink.Tasks build task and exposed via dotnet publish trimming settings.

The trimmer is always enabled for all size sensitive .NET workloads like Blazor WebAssembly, Xamarin or .NET mobile and can be manually enabled for other project types. The default apps trimming setting can be further customized by using a number of msbuild properties.

Dependencies Analyzer

The analyzer is a tool to analyze dependencies which were recorded during trimmer processing. It tracks details about reasons and connection between elements to keep it in the resulting linked assembly. It can be used to better understand the dependencies between different types and members to help further reduce the linked output.

Trimming Lens

The tlens is another tool for developers which can be used to explore ways to reduce the size of trimmed apps or exploring libraries readiness for trimming. The tool produces a recommendation where the compiled source could be improved to produce even smaller outputs when trimmed using the trimmer.

Source Code Analyzer

Another tool available for developers is implemented as Roslyn Analyzer which runs on source code and warns developers about code patterns and APIs which are problematic when building code which could be used with trimmed apps.

Contributing

We welcome contributions! Many developers have helped make this project better by reporting issues or contributing pull requests.

How to build all projects

There is a shell script available in the root folder which can build the whole project and much more (build.cmd on Windows).

./build.sh

Running tests from CLI

The same script can be used to run all tests from the terminal. We also have integration into Visual Studio and individual tests or whole test suites can be run within IDE as well.

./build.sh -test

CI Build & Test Status

Build Status