Zero Install .NET API 2.20.0

The ZeroInstall.Services namespace provides services for solving dependencies, downloading implementations, executing apps, etc..

Dependency injection

The ServiceProvider class provides instances of all important services. You can think of it as a hard-coded dependency injection container. We use this instead of a runtime DI system to avoid the performance overhead of reflection. This is important for Zero Install to keep the cold-start time as short as possible (e.g., to avoid 0install run for an already cached app from taking longer than necessary).

To instantiate the service provider you need to provide the constructor with a task handler. You should use exactly one instance of the service provider per user request to ensure consistent state during execution. Rather than instantiating the service provider class, another pattern used in the Zero Install code-base is to inherit from it.

You can also use the .AddZeroInstall() extension method for IServiceCollection to replace the service provider with .NET's built-in DI framework.


A strongly simplified version of the 0install run logic could use the services provided by the service provider as follows:

Sample code