Microsoft.Extensions.DependencyModel 8.0.0

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.

Showing the top 20 packages that depend on Microsoft.Extensions.DependencyModel.

Packages Downloads
SanedBuildingBlocks
This package built for OIG-Saned
3,379
SanedBuildingBlocks
This package built for OIG-Saned
2,352
SanedBuildingBlocks
This package built for OIG-Saned
909
SanedBuildingBlocks
This package built for OIG-Saned
832
SanedBuildingBlocks
This package built for OIG-Saned
741
SanedBuildingBlocks
This package built for OIG-Saned
645
SanedBuildingBlocks
This package built for OIG-Saned
450
SanedBuildingBlocks
This package built for OIG-Saned
420
SanedBuildingBlocks
This package built for OIG-Saned
275
SanedBuildingBlocks
This package built for OIG-Saned
267
SanedBuildingBlocks
This package built for OIG-Saned
190
SanedBuildingBlocks
This package built for OIG-Saned
185
SanedBuildingBlocks
This package built for OIG-Saned
183
SanedBuildingBlocks
This package built for OIG-Saned
124
SanedBuildingBlocks
This package built for OIG-Saned
119
SanedBuildingBlocks
This package built for OIG-Saned
116
SanedBuildingBlocks
This package built for OIG-Saned
113
SanedBuildingBlocks
This package built for OIG-Saned
109
SanedBuildingBlocks
This package built for OIG-Saned
102
SanedBuildingBlocks
This package built for OIG-Saned
93

https://go.microsoft.com/fwlink/?LinkID=799421

.NET Framework 4.6.2

.NET Standard 2.0

.NET 8.0

.NET 7.0

.NET 6.0

Version Downloads Last updated
8.0.0 14 01/22/2024
6.0.0 12 06/26/2023
5.0.0 11 06/16/2023
3.1.6 12 06/19/2023
3.1.3 12 08/16/2023
3.0.0 13 07/12/2023
1.0.3 11 06/29/2023