Microsoft.Extensions.DependencyModel (9.0.10)

Published 2026-02-04 09:31:43 +03:30 by kayer

Installation

dotnet nuget add source --name kayer --username your_username --password your_token 
dotnet add package --source kayer --version 9.0.10 Microsoft.Extensions.DependencyModel

About this package

Provides abstractions for reading .deps files. When a .NET application is compiled, the SDK generates a JSON manifest file (<ApplicationName>.deps.json) that contains information about application dependencies. You can use Microsoft.Extensions.DependencyModel to read information from this manifest at run time. This is useful when you want to dynamically compile code (for example, using Roslyn Emit API) referencing the same dependencies as your main application.

By default, the dependency manifest contains information about the application's target framework and runtime dependencies. Set the PreserveCompilationContext project property to true to additionally include information about reference assemblies used during compilation.

About

Provides abstractions for reading .deps files. When a .NET application is compiled, the SDK generates a JSON manifest file (<ApplicationName>.deps.json) that contains information about application dependencies. You can use Microsoft.Extensions.DependencyModel to read information from this manifest at run time. This is useful when you want to dynamically compile code (for example, using Roslyn Emit API) referencing the same dependencies as your main application.

By default, the dependency manifest contains information about the application's target framework and runtime dependencies. Set the PreserveCompilationContext project property to true to additionally include information about reference assemblies used during compilation.

How to Use

The following example shows how to display the list of assemblies used when compiling the current application. Include <PreserveCompilationContext>true</PreserveCompilationContext> in your project file to run this example.

using System;
using Microsoft.Extensions.DependencyModel;

class Program
{
    static void Main()
    {
        Console.WriteLine("Compilation libraries:");
        Console.WriteLine();

        foreach (CompilationLibrary lib in DependencyContext.Default.CompileLibraries)
        {
            foreach (string path in lib.ResolveReferencePaths())
            {
                Console.WriteLine(path);
            }
        }
    }
}

Additional Documentation

Feedback & Contributing

Microsoft.Extensions.DependencyModel is released as open source under the MIT license. Bug reports and contributions are welcome at the GitHub repository.

Dependencies

ID Version Target Framework
System.Text.Encodings.Web 9.0.10 .NETFramework4.6.2
System.Text.Json 9.0.10 .NETFramework4.6.2
System.Buffers 4.5.1 .NETFramework4.6.2
System.Memory 4.5.5 .NETFramework4.6.2
System.Text.Encodings.Web 9.0.10 .NETStandard2.0
System.Text.Json 9.0.10 .NETStandard2.0
System.Buffers 4.5.1 .NETStandard2.0
System.Memory 4.5.5 .NETStandard2.0
System.Text.Encodings.Web 9.0.10 net8.0
System.Text.Json 9.0.10 net8.0
Details
NuGet
2026-02-04 09:31:43 +03:30
122
Microsoft
222 KiB
Assets (2)
Versions (3) View all
10.0.0 2026-02-20
9.0.10 2026-02-04
9.0.0 2026-02-04