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

How to Use

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

Main Types

The main types provided by this library are:

  • System.Reflection.MetadataLoadContext
  • System.Reflection.MetadataAssemblyResolver

Additional Documentation

Feedback & Contributing

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

Packages Downloads
Microsoft.Build
This package contains the Microsoft.Build assembly which is used to create, edit, and evaluate MSBuild projects.
73
Microsoft.Build
This package contains the Microsoft.Build assembly which is used to create, edit, and evaluate MSBuild projects.
74
Microsoft.Build
This package contains the Microsoft.Build assembly which is used to create, edit, and evaluate MSBuild projects.
75
Microsoft.Build
This package contains the Microsoft.Build assembly which is used to create, edit, and evaluate MSBuild projects.
77
Microsoft.Build
This package contains the Microsoft.Build assembly which is used to create, edit, and evaluate MSBuild projects.
94
Microsoft.Build
This package contains the Microsoft.Build assembly which is used to create, edit, and evaluate MSBuild projects.
101
Microsoft.Build
This package contains the Microsoft.Build assembly which is used to create, edit, and evaluate MSBuild projects.
102
Microsoft.Build
This package contains the Microsoft.Build assembly which is used to create, edit, and evaluate MSBuild projects.
112
Microsoft.Build
This package contains the Microsoft.Build assembly which is used to create, edit, and evaluate MSBuild projects.
115
Microsoft.Build
This package contains the Microsoft.Build assembly which is used to create, edit, and evaluate MSBuild projects.
118
Microsoft.Build
This package contains the Microsoft.Build assembly which is used to create, edit, and evaluate MSBuild projects.
120
Microsoft.Build
This package contains the Microsoft.Build assembly which is used to create, edit, and evaluate MSBuild projects.
122
Microsoft.Build
This package contains the Microsoft.Build assembly which is used to create, edit, and evaluate MSBuild projects.
123
Microsoft.Build
This package contains the Microsoft.Build assembly which is used to create, edit, and evaluate MSBuild projects.
125
Microsoft.Build
This package contains the Microsoft.Build assembly which is used to create, edit, and evaluate MSBuild projects.
133
Microsoft.Build
This package contains the Microsoft.Build assembly which is used to create, edit, and evaluate MSBuild projects.
145

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

.NET Framework 4.6.2

.NET Standard 2.0

.NET 10.0

  • No dependencies.

.NET 9.0

.NET 8.0

Version Downloads Last updated
10.0.0 19 11/12/2025
10.0.0-rc.2.25502.107 27 10/14/2025
10.0.0-rc.1.25451.107 39 09/10/2025
10.0.0-preview.7.25380.108 43 08/13/2025
10.0.0-preview.6.25358.103 55 07/16/2025
10.0.0-preview.5.25277.114 56 06/07/2025
10.0.0-preview.4.25258.110 52 05/16/2025
10.0.0-preview.3.25171.5 60 04/14/2025
10.0.0-preview.2.25163.2 64 04/02/2025
10.0.0-preview.1.25080.5 72 04/01/2025
9.0.11 21 11/12/2025
9.0.10 26 10/14/2025
9.0.9 42 09/10/2025
9.0.8 45 08/05/2025
9.0.7 56 07/09/2025
9.0.6 55 06/12/2025
9.0.5 57 05/19/2025
9.0.4 65 04/09/2025
9.0.3 72 03/30/2025
9.0.2 70 03/30/2025
9.0.1 71 03/30/2025
9.0.0 78 11/14/2024
9.0.0-rc.2.24473.5 46 10/23/2024
9.0.0-rc.1.24431.7 67 09/19/2024
9.0.0-preview.7.24405.7 82 08/18/2024
9.0.0-preview.6.24327.7 94 07/19/2024
9.0.0-preview.5.24306.7 97 07/19/2024
9.0.0-preview.4.24266.19 95 07/19/2024
9.0.0-preview.3.24172.9 98 07/19/2024
9.0.0-preview.2.24128.5 114 07/19/2024
9.0.0-preview.1.24080.9 97 07/19/2024
8.0.1 63 10/22/2024
8.0.0 133 07/19/2024
8.0.0-rc.2.23479.6 88 07/19/2024
8.0.0-rc.1.23419.4 94 07/19/2024
8.0.0-preview.7.23375.6 92 07/19/2024
8.0.0-preview.6.23329.7 83 07/19/2024
8.0.0-preview.5.23280.8 98 07/19/2024
8.0.0-preview.4.23259.5 99 07/19/2024
8.0.0-preview.3.23174.8 91 07/19/2024
8.0.0-preview.2.23128.3 93 07/19/2024
8.0.0-preview.1.23110.8 106 07/19/2024
7.0.0 138 02/05/2024
7.0.0-rc.2.22472.3 90 07/19/2024
7.0.0-rc.1.22426.10 96 07/19/2024
7.0.0-preview.7.22375.6 104 07/19/2024
7.0.0-preview.6.22324.4 99 07/19/2024
7.0.0-preview.5.22301.12 100 07/19/2024
7.0.0-preview.4.22229.4 92 07/19/2024
7.0.0-preview.3.22175.4 89 07/19/2024
7.0.0-preview.2.22152.2 81 07/19/2024
7.0.0-preview.1.22076.8 98 07/19/2024
6.0.1 78 11/14/2024
6.0.0 112 02/04/2024
6.0.0-rc.2.21480.5 104 07/19/2024
6.0.0-rc.1.21451.13 94 07/19/2024
6.0.0-preview.7.21377.19 97 07/19/2024
6.0.0-preview.6.21352.12 106 07/19/2024
6.0.0-preview.5.21301.5 87 07/19/2024
6.0.0-preview.4.21253.7 99 07/19/2024
6.0.0-preview.3.21201.4 92 07/19/2024
6.0.0-preview.2.21154.6 93 07/19/2024
6.0.0-preview.1.21102.12 93 07/19/2024
5.0.1 97 07/19/2024
5.0.0 92 07/19/2024
5.0.0-rc.2.20475.5 109 07/19/2024
5.0.0-rc.1.20451.14 91 07/19/2024
5.0.0-preview.8.20407.11 79 07/19/2024
5.0.0-preview.7.20364.11 106 07/19/2024
5.0.0-preview.6.20305.6 100 07/19/2024
5.0.0-preview.5.20278.1 87 07/19/2024
5.0.0-preview.4.20251.6 94 07/19/2024
5.0.0-preview.3.20214.6 93 07/19/2024
5.0.0-preview.2.20160.6 108 07/19/2024
5.0.0-preview.1.20120.5 97 07/19/2024
4.7.2 90 07/19/2024
4.7.1 108 07/19/2024
4.7.0 91 07/19/2024
4.7.0-preview3.19551.4 91 07/19/2024
4.7.0-preview2.19523.17 97 07/19/2024
4.7.0-preview1.19504.10 101 07/19/2024
4.6.0 100 07/19/2024
4.6.0-rc1.19456.4 95 07/19/2024
4.6.0-preview9.19421.4 94 07/19/2024
4.6.0-preview9.19416.11 99 07/19/2024
4.6.0-preview8.19405.3 91 07/19/2024
4.6.0-preview7.19362.9 95 07/19/2024
4.6.0-preview6.19303.8 92 07/19/2024
4.6.0-preview6.19264.9 95 07/19/2024
4.6.0-preview5.19224.8 102 07/19/2024
4.6.0-preview4.19212.13 85 07/19/2024
4.6.0-preview3.19128.7 101 07/19/2024
4.6.0-preview.19073.11 91 07/19/2024
4.6.0-preview.18571.3 90 07/19/2024