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,440
SanedBuildingBlocks
This package built for OIG-Saned
2,437
SanedBuildingBlocks
This package built for OIG-Saned
915
SanedBuildingBlocks
This package built for OIG-Saned
837
SanedBuildingBlocks
This package built for OIG-Saned
762
SanedBuildingBlocks
This package built for OIG-Saned
650
SanedBuildingBlocks
This package built for OIG-Saned
458
SanedBuildingBlocks
This package built for OIG-Saned
426
SanedBuildingBlocks
This package built for OIG-Saned
280
SanedBuildingBlocks
This package built for OIG-Saned
272
SanedBuildingBlocks
This package built for OIG-Saned
234
SanedBuildingBlocks
This package built for OIG-Saned
231
SanedBuildingBlocks
This package built for OIG-Saned
195
SanedBuildingBlocks
This package built for OIG-Saned
189
SanedBuildingBlocks
This package built for OIG-Saned
187
SanedBuildingBlocks
This package built for OIG-Saned
185
SanedBuildingBlocks
This package built for OIG-Saned
130
SanedBuildingBlocks
This package built for OIG-Saned
124
SanedBuildingBlocks
This package built for OIG-Saned
120
SanedBuildingBlocks
This package built for OIG-Saned
118

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 19 01/22/2024
6.0.0 16 06/26/2023
5.0.0 15 06/16/2023
3.1.6 16 06/19/2023
3.1.3 16 08/16/2023
3.0.0 17 07/12/2023
1.0.3 15 06/29/2023