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,447
SanedBuildingBlocks
This package built for OIG-Saned
2,467
SanedBuildingBlocks
This package built for OIG-Saned
920
SanedBuildingBlocks
This package built for OIG-Saned
843
SanedBuildingBlocks
This package built for OIG-Saned
770
SanedBuildingBlocks
This package built for OIG-Saned
655
SanedBuildingBlocks
This package built for OIG-Saned
464
SanedBuildingBlocks
This package built for OIG-Saned
431
SanedBuildingBlocks
This package built for OIG-Saned
359
SanedBuildingBlocks
This package built for OIG-Saned
285
SanedBuildingBlocks
This package built for OIG-Saned
276
SanedBuildingBlocks
This package built for OIG-Saned
240
SanedBuildingBlocks
This package built for OIG-Saned
237
SanedBuildingBlocks
This package built for OIG-Saned
233
SanedBuildingBlocks
This package built for OIG-Saned
202
SanedBuildingBlocks
This package built for OIG-Saned
199
SanedBuildingBlocks
This package built for OIG-Saned
195
SanedBuildingBlocks
This package built for OIG-Saned
193
SanedBuildingBlocks
This package built for OIG-Saned
192
SanedBuildingBlocks
This package built for OIG-Saned
136

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 25 01/22/2024
6.0.0 20 06/26/2023
5.0.0 20 06/16/2023
3.1.6 21 06/19/2023
3.1.3 23 08/16/2023
3.0.0 24 07/12/2023
1.0.3 18 06/29/2023