System.Reflection.MetadataLoadContext
7.0.0
See the version list below for details.
dotnet add package System.Reflection.MetadataLoadContext --version 7.0.0
NuGet\Install-Package System.Reflection.MetadataLoadContext -Version 7.0.0
<PackageReference Include="System.Reflection.MetadataLoadContext" Version="7.0.0" />
paket add System.Reflection.MetadataLoadContext --version 7.0.0
#r "nuget: System.Reflection.MetadataLoadContext, 7.0.0"
// Install System.Reflection.MetadataLoadContext as a Cake Addin
#addin nuget:?package=System.Reflection.MetadataLoadContext&version=7.0.0
// Install System.Reflection.MetadataLoadContext as a Cake Tool
#tool nuget:?package=System.Reflection.MetadataLoadContext&version=7.0.0
About
Provides read-only reflection on assemblies in an isolated context with support for assemblies that target different processor architectures and runtimes. Using MetadataLoadContext enables you to inspect assemblies without loading them into the main execution context. Assemblies in MetadataLoadContext are treated only as metadata, that is, you can read information about their members, but cannot execute any code contained in them.
For more information, see the documentation:
- How to: Inspect assembly contents using MetadataLoadContext
- System.Reflection.MetadataLoadContext
- System.Reflection.MetadataAssemblyResolver
Example
The following example shows how to print the list of types defined in an assembly.
using System;
using System.Reflection;
class Program
{
static void Main()
{
string inspectedAssembly = "Example.dll";
var resolver = new PathAssemblyResolver(new string[] {inspectedAssembly, typeof(object).Assembly.Location});
using var mlc = new MetadataLoadContext(resolver, typeof(object).Assembly.GetName().ToString());
// Load assembly into MetadataLoadContext
Assembly assembly = mlc.LoadFromAssemblyPath(inspectedAssembly);
AssemblyName name = assembly.GetName();
// Print types defined in assembly
Console.WriteLine($"{name.Name} has following types: ");
foreach (Type t in assembly.GetTypes())
{
Console.WriteLine(t.FullName);
}
}
}
Product | Versions |
---|---|
.NET | net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows net7.0 net7.0-android net7.0-ios net7.0-maccatalyst net7.0-macos net7.0-tvos net7.0-windows |
.NET Core | netcoreapp2.0 netcoreapp2.1 netcoreapp2.2 netcoreapp3.0 netcoreapp3.1 |
.NET Standard | netstandard2.0 netstandard2.1 |
.NET Framework | net461 net462 net463 net47 net471 net472 net48 net481 |
MonoAndroid | monoandroid |
MonoMac | monomac |
MonoTouch | monotouch |
Tizen | tizen40 tizen60 |
Xamarin.iOS | xamarinios |
Xamarin.Mac | xamarinmac |
Xamarin.TVOS | xamarintvos |
Xamarin.WatchOS | xamarinwatchos |
-
.NETFramework 4.6.2
- System.Collections.Immutable (>= 7.0.0)
- System.Memory (>= 4.5.5)
- System.Reflection.Metadata (>= 7.0.0)
-
.NETStandard 2.0
- System.Collections.Immutable (>= 7.0.0)
- System.Memory (>= 4.5.5)
- System.Reflection.Metadata (>= 7.0.0)
-
net6.0
- System.Collections.Immutable (>= 7.0.0)
- System.Reflection.Metadata (>= 7.0.0)
-
net7.0
- System.Collections.Immutable (>= 7.0.0)
- System.Reflection.Metadata (>= 7.0.0)
NuGet packages (46)
Showing the top 5 NuGet packages that depend on System.Reflection.MetadataLoadContext:
Package | Downloads |
---|---|
Microsoft.Build
This package contains the Microsoft.Build assembly which is used to create, edit, and evaluate MSBuild projects. |
|
Steeltoe.Common
Steeltoe common library |
|
DotNetCore.Natasha.CSharp.All
发布最新版 Natasha |
|
KY.Generator.Core
Core elements for KY-Generator Download KY.Generator to use this module |
|
RProvider
An F# Type Provider providing strongly typed access to the R statistical package. The type provider automatically discovers available R packages and makes them easily accessible from F#, so you can easily call powerful packages and visualization libraries from code running on the .NET platform. |
GitHub repositories (21)
Showing the top 5 popular GitHub repositories that depend on System.Reflection.MetadataLoadContext:
Repository | Stars |
---|---|
dotnet/runtime
.NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.
|
|
dotnet/wpf
WPF is a .NET Core UI framework for building Windows desktop applications.
|
|
dotnet/msbuild
The Microsoft Build Engine (MSBuild) is the build platform for .NET and Visual Studio.
|
|
Azure/azure-powershell
Microsoft Azure PowerShell
|
|
dotnet/samples
Sample code referenced by the .NET documentation
|