System.Reflection.MetadataLoadContext 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:

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);
        }
    }
}

Showing the top 20 packages that depend on System.Reflection.MetadataLoadContext.

Packages Downloads
Microsoft.Build
This package contains the Microsoft.Build assembly which is used to create, edit, and evaluate MSBuild projects.
6
Microsoft.Build
This package contains the Microsoft.Build assembly which is used to create, edit, and evaluate MSBuild projects.
15
Microsoft.Build
This package contains the Microsoft.Build assembly which is used to create, edit, and evaluate MSBuild projects.
23
Microsoft.Build
This package contains the Microsoft.Build assembly which is used to create, edit, and evaluate MSBuild projects.
24
Microsoft.Build
This package contains the Microsoft.Build assembly which is used to create, edit, and evaluate MSBuild projects.
26
Microsoft.Build
This package contains the Microsoft.Build assembly which is used to create, edit, and evaluate MSBuild projects.
27
Microsoft.Build
This package contains the Microsoft.Build assembly which is used to create, edit, and evaluate MSBuild projects.
29
Microsoft.Build
This package contains the Microsoft.Build assembly which is used to create, edit, and evaluate MSBuild projects.
31
Microsoft.Build
This package contains the Microsoft.Build assembly which is used to create, edit, and evaluate MSBuild projects.
33
Microsoft.Build
This package contains the Microsoft.Build assembly which is used to create, edit, and evaluate MSBuild projects.
35
Microsoft.Build
This package contains the Microsoft.Build assembly which is used to create, edit, and evaluate MSBuild projects.
43

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

Version Downloads Last updated
9.0.0-rc.1.24431.7 1 09/19/2024
9.0.0-preview.7.24405.7 7 08/18/2024
9.0.0-preview.6.24327.7 20 07/19/2024
9.0.0-preview.5.24306.7 24 07/19/2024
9.0.0-preview.4.24266.19 24 07/19/2024
9.0.0-preview.3.24172.9 24 07/19/2024
9.0.0-preview.2.24128.5 34 07/19/2024
9.0.0-preview.1.24080.9 27 07/19/2024
8.0.0 20 07/19/2024
8.0.0-rc.2.23479.6 24 07/19/2024
8.0.0-rc.1.23419.4 25 07/19/2024
8.0.0-preview.7.23375.6 28 07/19/2024
8.0.0-preview.6.23329.7 23 07/19/2024
8.0.0-preview.5.23280.8 21 07/19/2024
8.0.0-preview.4.23259.5 25 07/19/2024
8.0.0-preview.3.23174.8 25 07/19/2024
8.0.0-preview.2.23128.3 25 07/19/2024
8.0.0-preview.1.23110.8 32 07/19/2024
7.0.0 47 02/05/2024
7.0.0-rc.2.22472.3 25 07/19/2024
7.0.0-rc.1.22426.10 30 07/19/2024
7.0.0-preview.7.22375.6 33 07/19/2024
7.0.0-preview.6.22324.4 25 07/19/2024
7.0.0-preview.5.22301.12 30 07/19/2024
7.0.0-preview.4.22229.4 23 07/19/2024
7.0.0-preview.3.22175.4 22 07/19/2024
7.0.0-preview.2.22152.2 23 07/19/2024
7.0.0-preview.1.22076.8 24 07/19/2024
6.0.0 35 02/04/2024
6.0.0-rc.2.21480.5 33 07/19/2024
6.0.0-rc.1.21451.13 23 07/19/2024
6.0.0-preview.7.21377.19 25 07/19/2024
6.0.0-preview.6.21352.12 26 07/19/2024
6.0.0-preview.5.21301.5 27 07/19/2024
6.0.0-preview.4.21253.7 31 07/19/2024
6.0.0-preview.3.21201.4 26 07/19/2024
6.0.0-preview.2.21154.6 23 07/19/2024
6.0.0-preview.1.21102.12 25 07/19/2024
5.0.1 23 07/19/2024
5.0.0 24 07/19/2024
5.0.0-rc.2.20475.5 33 07/19/2024
5.0.0-rc.1.20451.14 20 07/19/2024
5.0.0-preview.8.20407.11 21 07/19/2024
5.0.0-preview.7.20364.11 34 07/19/2024
5.0.0-preview.6.20305.6 24 07/19/2024
5.0.0-preview.5.20278.1 19 07/19/2024
5.0.0-preview.4.20251.6 22 07/19/2024
5.0.0-preview.3.20214.6 25 07/19/2024
5.0.0-preview.2.20160.6 28 07/19/2024
5.0.0-preview.1.20120.5 27 07/19/2024
4.7.2 24 07/19/2024
4.7.1 32 07/19/2024
4.7.0 26 07/19/2024
4.7.0-preview3.19551.4 23 07/19/2024
4.7.0-preview2.19523.17 27 07/19/2024
4.7.0-preview1.19504.10 29 07/19/2024
4.6.0 26 07/19/2024
4.6.0-rc1.19456.4 29 07/19/2024
4.6.0-preview9.19421.4 25 07/19/2024
4.6.0-preview9.19416.11 28 07/19/2024
4.6.0-preview8.19405.3 19 07/19/2024
4.6.0-preview7.19362.9 30 07/19/2024
4.6.0-preview6.19303.8 20 07/19/2024
4.6.0-preview6.19264.9 23 07/19/2024
4.6.0-preview5.19224.8 27 07/19/2024
4.6.0-preview4.19212.13 22 07/19/2024
4.6.0-preview3.19128.7 29 07/19/2024
4.6.0-preview.19073.11 22 07/19/2024
4.6.0-preview.18571.3 24 07/19/2024