![]() |
VOOZH | about |
dotnet add package System.Reflection.Metadata --version 10.0.9
NuGet\Install-Package System.Reflection.Metadata -Version 10.0.9
<PackageReference Include="System.Reflection.Metadata" Version="10.0.9" />
<PackageVersion Include="System.Reflection.Metadata" Version="10.0.9" />Directory.Packages.props
<PackageReference Include="System.Reflection.Metadata" />Project file
paket add System.Reflection.Metadata --version 10.0.9
#r "nuget: System.Reflection.Metadata, 10.0.9"
#:package System.Reflection.Metadata@10.0.9
#addin nuget:?package=System.Reflection.Metadata&version=10.0.9Install as a Cake Addin
#tool nuget:?package=System.Reflection.Metadata&version=10.0.9Install as a Cake Tool
This package provides a low-level .NET (ECMA-335) metadata reader and writer. It's geared for performance and is the ideal choice for building higher-level libraries that intend to provide their own object model, such as compilers. The metadata format is defined by the ECMA-335 - Common Language Infrastructure (CLI) specification and its amendments.
The System.Reflection.Metadata library is included in the .NET Runtime shared framework. The package can be installed when you need to use it in other target frameworks.
The following example shows how to read assembly information using PEReader and MetadataReader.
using System;
using System.IO;
using System.Reflection.Metadata;
using System.Reflection.PortableExecutable;
class Program
{
static void Main()
{
// Open the Portable Executable (PE) file
using var fs = new FileStream("Example.dll", FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
using var peReader = new PEReader(fs);
// Display PE header information
PEHeader header = peReader.PEHeaders.PEHeader;
Console.WriteLine($"Image base: 0x{header.ImageBase:X}");
Console.WriteLine($"File alignment: 0x{header.FileAlignment:X}");
Console.WriteLine($"Subsystem: {header.Subsystem}");
// Display .NET metadata information
if (!peReader.HasMetadata)
{
Console.WriteLine("Image does not contain .NET metadata");
return;
}
MetadataReader mr = peReader.GetMetadataReader();
AssemblyDefinition ad = mr.GetAssemblyDefinition();
Console.WriteLine($"Assembly name: {ad.GetAssemblyName().ToString()}");
Console.WriteLine();
Console.WriteLine("Assembly attributes:");
foreach (CustomAttributeHandle attrHandle in ad.GetCustomAttributes())
{
CustomAttribute attr = mr.GetCustomAttribute(attrHandle);
// Display the attribute type full name
if (attr.Constructor.Kind == HandleKind.MethodDefinition)
{
MethodDefinition mdef = mr.GetMethodDefinition((MethodDefinitionHandle)attr.Constructor);
TypeDefinition tdef = mr.GetTypeDefinition(mdef.GetDeclaringType());
Console.WriteLine($"{mr.GetString(tdef.Namespace)}.{mr.GetString(tdef.Name)}");
}
else if (attr.Constructor.Kind == HandleKind.MemberReference)
{
MemberReference mref = mr.GetMemberReference((MemberReferenceHandle)attr.Constructor);
if (mref.Parent.Kind == HandleKind.TypeReference)
{
TypeReference tref = mr.GetTypeReference((TypeReferenceHandle)mref.Parent);
Console.WriteLine($"{mr.GetString(tref.Namespace)}.{mr.GetString(tref.Name)}");
}
else if (mref.Parent.Kind == HandleKind.TypeDefinition)
{
TypeDefinition tdef = mr.GetTypeDefinition((TypeDefinitionHandle)mref.Parent);
Console.WriteLine($"{mr.GetString(tdef.Namespace)}.{mr.GetString(tdef.Name)}");
}
}
}
}
}
The main types provided by this library are:
System.Reflection.Metadata.MetadataReaderSystem.Reflection.PortableExecutable.PEReaderSystem.Reflection.Metadata.Ecma335.MetadataBuilderSystem.Reflection.PortableExecutable.PEBuilderSystem.Reflection.PortableExecutable.ManagedPEBuilderSystem.Reflection.Metadata is released as open source under the MIT license. Bug reports and contributions are welcome at the GitHub repository.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 net5.0 was computed. net5.0-windows net5.0-windows was computed. net6.0 net6.0 was computed. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 was computed. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 is compatible. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 is compatible. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 is compatible. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 netcoreapp2.0 was computed. netcoreapp2.1 netcoreapp2.1 was computed. netcoreapp2.2 netcoreapp2.2 was computed. netcoreapp3.0 netcoreapp3.0 was computed. netcoreapp3.1 netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 netstandard2.0 is compatible. netstandard2.1 netstandard2.1 was computed. |
| .NET Framework | net461 net461 was computed. net462 net462 is compatible. net463 net463 was computed. net47 net47 was computed. net471 net471 was computed. net472 net472 was computed. net48 net48 was computed. net481 net481 was computed. |
| MonoAndroid | monoandroid monoandroid was computed. |
| MonoMac | monomac monomac was computed. |
| MonoTouch | monotouch monotouch was computed. |
| Tizen | tizen40 tizen40 was computed. tizen60 tizen60 was computed. |
| Xamarin.iOS | xamarinios xamarinios was computed. |
| Xamarin.Mac | xamarinmac xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos xamarinwatchos was computed. |
Showing the top 5 NuGet packages that depend on System.Reflection.Metadata:
| Package | Downloads |
|---|---|
|
Microsoft.TestPlatform.ObjectModel
The Microsoft Test Platform Object Model. |
|
|
Microsoft.CodeAnalysis.Common
A shared package used by the Microsoft .NET Compiler Platform ("Roslyn"). Do not install this package manually, it will be added as a prerequisite by other packages that require it. More details at https://aka.ms/roslyn-packages This package was built from the source at https://github.com/dotnet/roslyn/commit/16f9bd284cd49604ac82998bfe778a8eb16d4347. |
|
|
Microsoft.CodeAnalysis.CSharp
.NET Compiler Platform ("Roslyn") support for C#, Microsoft.CodeAnalysis.CSharp.dll. More details at https://aka.ms/roslyn-packages This package was built from the source at https://github.com/dotnet/roslyn/commit/16f9bd284cd49604ac82998bfe778a8eb16d4347. |
|
|
Microsoft.CodeAnalysis.Workspaces.Common
A shared package used by the .NET Compiler Platform ("Roslyn") including support for analyzing projects and solutions. Do not install this package manually, it will be added as a prerequisite by other packages that require it. More details at https://aka.ms/roslyn-packages This package was built from the source at https://github.com/dotnet/roslyn/commit/16f9bd284cd49604ac82998bfe778a8eb16d4347. |
|
|
Microsoft.AspNetCore.Hosting
ASP.NET Core hosting infrastructure and startup logic for web applications. |
Showing the top 20 popular GitHub repositories that depend on System.Reflection.Metadata:
| Repository | Stars |
|---|---|
|
icsharpcode/ILSpy
.NET Decompiler with support for PDB generation, ReadyToRun, Metadata (&more) - cross-platform!
|
|
|
dotnet/roslyn
The Roslyn .NET compiler provides C# and Visual Basic languages with rich code analysis APIs.
|
|
|
DapperLib/Dapper
Dapper - a simple object mapper for .Net
|
|
|
dotnet/runtime
.NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.
|
|
|
winsw/winsw
A wrapper executable that can run any executable as a Windows service, in a permissive license.
|
|
|
chocolatey/choco
Chocolatey - the package manager for Windows
|
|
|
mRemoteNG/mRemoteNG
mRemoteNG is the next generation of mRemote, open source, tabbed, multi-protocol, remote connections manager.
|
|
|
neuecc/UniRx
Reactive Extensions for Unity
|
|
|
NancyFx/Nancy
Lightweight, low-ceremony, framework for building HTTP based services on .Net and Mono
|
|
|
StackExchange/StackExchange.Redis
General purpose redis client
|
|
|
dotnet/msbuild
The Microsoft Build Engine (MSBuild) is the build platform for .NET and Visual Studio.
|
|
|
UnigramDev/Unigram
Telegram for Windows
|
|
|
protobuf-net/protobuf-net
Protocol Buffers library for idiomatic .NET
|
|
|
dotnet/winforms
Windows Forms is a .NET UI framework for building Windows desktop applications.
|
|
|
microsoft/perfview
PerfView is a CPU and memory performance-analysis tool
|
|
|
Fody/Fody
Extensible tool for weaving .net assemblies
|
|
|
microsoft/ApplicationInspector
A source code analyzer built for surfacing features of interest and other characteristics to answer the question 'What's in the code?' quickly using static analysis with a json based rules engine. Ideal for scanning components before use or detecting feature level changes.
|
|
|
fluentassertions/fluentassertions
A very extensive set of extension methods that allow you to more naturally specify the expected outcome of a TDD or BDD-style unit tests. Targets .NET Framework 4.7, as well as .NET Core 2.1, .NET Core 3.0, .NET 6, .NET Standard 2.0 and 2.1. Supports the unit test frameworks MSTest2, NUnit3, XUnit2, MSpec, and NSpec3.
|
|
|
dotnet/interactive
.NET Interactive combines the power of .NET with many other languages to create notebooks, REPLs, and embedded coding experiences. Share code, explore data, write, and learn across your apps in ways you couldn't before.
|
|
|
coverlet-coverage/coverlet
Cross platform code coverage for .NET
|
| Version | Downloads | Last Updated |
|---|---|---|
| 11.0.0-preview.5.26302.115 | 372 | 6/9/2026 |
| 11.0.0-preview.4.26230.115 | 1,150 | 5/12/2026 |
| 11.0.0-preview.3.26207.106 | 1,452 | 4/14/2026 |
| 11.0.0-preview.2.26159.112 | 2,245 | 3/10/2026 |
| 11.0.0-preview.1.26104.118 | 1,378 | 2/10/2026 |
| 10.0.9 | 47,357 | 6/9/2026 |
| 10.0.8 | 203,512 | 5/12/2026 |
| 10.0.7 | 213,064 | 4/21/2026 |
| 10.0.6 | 90,444 | 4/14/2026 |
| 10.0.5 | 315,724 | 3/12/2026 |
| 10.0.4 | 48,649 | 3/10/2026 |
| 10.0.3 | 358,443 | 2/10/2026 |
| 10.0.2 | 730,403 | 1/13/2026 |
| 10.0.1 | 768,633 | 12/9/2025 |
| 9.0.17 | 1,370 | 6/9/2026 |
| 9.0.16 | 16,632 | 5/12/2026 |
| 9.0.15 | 49,412 | 4/14/2026 |
| 9.0.14 | 67,441 | 3/10/2026 |
| 9.0.13 | 95,888 | 2/10/2026 |
| 9.0.12 | 139,020 | 1/13/2026 |