Serdar Yegulalp
Senior Writer

Microsoft linker tool shrinks .Net applications

news
Aug 30, 20172 mins

The .Net IL Linker reduces the footprint of .Net apps by discarding unused libraries and references, although it's still in the preview stages

code wave tsunami
Credit: Thinkstock

A long-requested and long-unfulfilled feature for .Net has finally been delivered by Microsoft and the Mono team: A linker that allows .Net applications to be stripped down to include only the parts of libraries that are actually used by the program at runtime.

The IL Linker project works by analyzing a .Net application and determining which libraries are never called by the application in question. “It is effectively an application-specific dead code analysis,” says Microsoft in its GitHub announcement for the project.

A long-term mission for IL Linker is to make it into “the primary linker for the .Net ecosystem.”

The current, preview version of IL Linker only supports a small subset of possible .Net applications—those that are self-contained and use the .Net Core. How much space is saved for a given application will vary widely, but Microsoft states that “in trivial cases, the linker can reduce the size of applications by 50%.”

It has historically been difficult to slim down .Net applications because of the platform’s dynamic features. IL Linker searches through the code starting from any assemblies or dependencies that are explicitly declared in the application, and flags everything that it determines to be unused.

Right now, the algorithms used for this mark-and-sweep err on the side of caution, but it is still possible for IL Linker to flag code that is dynamically imported at runtime. However, the end user can always manually specify what to keep, whether it is an entire assembly or only a specific type within that assembly.

Some of IL Linker’s work is based on an earlier project, Cecil, used by .Net developers since 2004 to inspect and modify .Net apps and libraries. The chief difference between the two is that Cecil is mainly for manual inspection and modification, with the creation of a smaller app just one of several possible goals. IL Linker is designed specifically for slimming down the footprint of a .Net app.

Serdar Yegulalp

Serdar Yegulalp is a senior writer at InfoWorld. A veteran technology journalist, Serdar has been writing about computers, operating systems, databases, programming, and other information technology topics for 30 years. Before joining InfoWorld in 2013, Serdar wrote for Windows Magazine, InformationWeek, Byte, and a slew of other publications. At InfoWorld, Serdar has covered software development, devops, containerization, machine learning, and artificial intelligence, winning several B2B journalism awards including a 2024 Neal Award and a 2025 Azbee Award for best instructional content and best how-to article, respectively. He currently focuses on software development tools and technologies and major programming languages including Python, Rust, Go, Zig, and Wasm. Tune into his weekly Dev with Serdar videos for programming tips and techniques and close looks at programming libraries and tools.

More from this author