Microsoft.Extensions.DependencyModel 10.0.2
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
- .deps.json file format
- Microsoft.Extensions.DependencyModel namespace
- Microsoft.Extensions.DependencyModel.DependencyContext
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 |
|---|---|
|
Microsoft.EntityFrameworkCore.Sqlite.Core
SQLite database provider for Entity Framework Core. This package does not include a copy of the native SQLite library.
|
271 |
|
Microsoft.EntityFrameworkCore.Design
Shared design-time components for Entity Framework Core tools.
|
265 |
|
Serilog.Settings.Configuration
Microsoft.Extensions.Configuration (appsettings.json) support for Serilog.
|
262 |
|
Microsoft.AspNetCore.Mvc.Testing
Support for writing functional tests for MVC applications.
This package was built from the source code at https://github.com/dotnet/aspnetcore/tree/954f61dd38b33caa2b736c73530bd5a294174437
|
219 |
|
IKVM
Java SE 8 Virtual Machine for .NET
|
21 |
|
IKVM
Java SE 8 Virtual Machine for .NET
|
20 |
|
IKVM
Java SE 8 Virtual Machine for .NET
|
17 |
|
IKVM
Java SE 8 Virtual Machine for .NET
|
16 |
|
IKVM
Java SE 8 Virtual Machine for .NET
|
15 |
|
IKVM
Java SE 8 Virtual Machine for .NET
|
14 |
|
Microsoft.EntityFrameworkCore.Sqlite.Core
SQLite database provider for Entity Framework Core. This package does not include a copy of the native SQLite library.
|
14 |
|
IKVM
Java SE 8 Virtual Machine for .NET
|
13 |
|
Microsoft.VisualStudio.Web.CodeGenerators.Mvc
Code Generators for ASP.NET Core MVC. Contains code generators for MVC Controllers and Views.
|
13 |
.NET Framework 4.6.2
- System.Text.Encodings.Web (>= 10.0.2)
- System.Text.Json (>= 10.0.2)
- System.Buffers (>= 4.6.1)
- System.Memory (>= 4.6.3)
.NET 8.0
- System.Text.Encodings.Web (>= 10.0.2)
- System.Text.Json (>= 10.0.2)
.NET 9.0
- System.Text.Encodings.Web (>= 10.0.2)
- System.Text.Json (>= 10.0.2)
.NET 10.0
- No dependencies.
.NET Standard 2.0
- System.Text.Encodings.Web (>= 10.0.2)
- System.Text.Json (>= 10.0.2)
- System.Buffers (>= 4.6.1)
- System.Memory (>= 4.6.3)