{"id":23584074,"url":"https://github.com/trippwill/sharp-meta","last_synced_at":"2026-02-24T02:03:34.306Z","repository":{"id":260772838,"uuid":"882298737","full_name":"trippwill/sharp-meta","owner":"trippwill","description":"An opiniated library for inspecting .NET assembly Metadata","archived":false,"fork":false,"pushed_at":"2025-02-16T00:26:00.000Z","size":175,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-16T01:20:36.898Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://trippwill.github.io/sharp-meta/","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/trippwill.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-11-02T12:56:38.000Z","updated_at":"2025-02-16T00:26:02.000Z","dependencies_parsed_at":"2025-01-03T15:24:57.388Z","dependency_job_id":"af4286f3-3ce2-44e6-a254-1a0d16224b36","html_url":"https://github.com/trippwill/sharp-meta","commit_stats":{"total_commits":34,"total_committers":2,"mean_commits":17.0,"dds":0.02941176470588236,"last_synced_commit":"ec30574e1bd55a062590e20a83cd17b2fc4af954"},"previous_names":["trippwill/sharp-meta"],"tags_count":14,"template":false,"template_full_name":"AArnott/Library.Template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trippwill%2Fsharp-meta","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trippwill%2Fsharp-meta/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trippwill%2Fsharp-meta/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trippwill%2Fsharp-meta/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/trippwill","download_url":"https://codeload.github.com/trippwill/sharp-meta/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239403603,"owners_count":19632618,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-27T02:20:09.729Z","updated_at":"2025-11-03T00:30:25.119Z","avatar_url":"https://github.com/trippwill.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SharpMeta\n\n***An opiniated library for inspecting .NET assembly Metadata***\n\n[![CI](https://github.com/trippwill/sharp-meta/actions/workflows/libanvl-dotnet-ci.yml/badge.svg)](https://github.com/trippwill/sharp-meta/actions/workflows/libanvl-dotnet-ci.yml)\n[![NuGet package](https://img.shields.io/nuget/v/SharpMeta.svg)](https://nuget.org/packages/SharpMeta)\n[![codecov](https://codecov.io/gh/trippwill/sharp-meta/graph/badge.svg?token=uzEl9z9BoS)](https://codecov.io/gh/trippwill/sharp-meta)\n[![CodeQL](https://github.com/trippwill/sharp-meta/actions/workflows/github-code-scanning/codeql/badge.svg)](https://github.com/trippwill/sharp-meta/actions/workflows/github-code-scanning/codeql)\n\n# SharpMeta\n\nSharpMeta is a .NET library that facilitates the loading and inspection of .NET assemblies using the `System.Reflection.MetadataLoadContext`.\nThis library provides a robust and flexible way to load assemblies from specified file paths and directories,\nwhile also providing extension methods for inspecting type and attribute metadata.\n\nUsing `SharpAssemblyResolver.Builder.AddReferenceDirectories(\"path/to/target-framework\")`, SharpMeta can load and inspect .NET assemblies compiled for any target framework -- including .NET and .NET Framework.\n\n## Features\n\n- Load assemblies from specified file paths.\n- Recursively search directories for assemblies.\n- Log errors and information during the loading process.\n- Utilize `MetadataLoadContext` for inspecting assemblies without loading them into the main application domain.\n- Extension methods for `Type`, `PropertyInfo`, `MemberInfo`, and `CustomAttributeData` to facilitate inspecting type and attribute metadata.\n- Get XML documentation comments for types, properties, and members (requires XML documentation files to be present).\n\n## Getting Started\n\n### Prerequisites\n\n- .NET 8.0 SDK\n\n### Installation\n\nTo use SharpMeta in your project, add the following package reference to your `.csproj` file:\n\n```csharp\n\u003cItemGroup\u003e\n  \u003cPackageReference Include=\"SharpMeta\" /\u003e\n\u003c/ItemGroup\u003e\n```\n\n### Usage\n\nBelow is an example of how to use the `SharpAssemblyResolver` class provided by SharpMeta:\n\n\n```csharp\nusing System;\nusing System.IO;\nusing System.Reflection;\nusing SharpMeta;\n\nclass Program\n{\n    static void Main()\n    {\n        var referenceFiles = new FileInfo[]\n        {\n            new FileInfo(\"path/to/your/assembly1.dll\"),\n            new FileInfo(\"path/to/your/assembly2.dll\")\n        };\n\n        var referenceDirectories = new DirectoryInfo[]\n        {\n            new DirectoryInfo(\"path/to/your/reference/directory\")\n        };\n\n        using var context = SharpAssemblyResolver.CreateBuilder()\n            .AddReferenceFiles(referenceFiles)\n            .AddReferenceDirectories(referenceDirectories)\n            .ToAssemblyResolver()\n            .ToMetadataLoadContext();\n\n        var assembly = context.LoadFromAssemblyPath(\"path/to/your/target/assembly.dll\");\n        Console.WriteLine($\"Loaded Assembly: {assembly.FullName}\");\n\n        // Example usage of extension methods\n        foreach (var type in assembly.GetTypes())\n        {\n            if (type.ImplementsAnyInterface((\"System.Collections\", \"IEnumerable\")))\n            {\n                Console.WriteLine($\"{type.FullName} implements IEnumerable\");\n            }\n\n            if (type.IsProbableDictionary(out var keyType, out var valueType))\n            {\n                Console.WriteLine($\"{type.FullName} is a probable dictionary with key type {keyType} and value type {valueType}\");\n            }\n\n            foreach (var property in type.GetProperties())\n            {\n                if (property.IsNullable())\n                {\n                    Console.WriteLine($\"{property.Name} is nullable\");\n                }\n            }\n\n            foreach (var member in type.GetMembers())\n            {\n                if (member.TryGetCustomAttributeData\u003cObsoleteAttribute\u003e(out var attributeData))\n                {\n                    Console.WriteLine($\"{member.Name} has ObsoleteAttribute with message: {attributeData.GetNamedArgument\u003cstring\u003e(\"Message\")}\");\n                }\n            }\n        }\n    }\n}\n```\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a pull request or open an issue to discuss any changes. See [CONTRIBUTING](CONTRIBUTING.md).\n\n## License\n\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.\n\n## Acknowledgments\n\n- [System.Reflection.MetadataLoadContext](https://www.nuget.org/packages/System.Reflection.MetadataLoadContext/)\n- [Nerdbank.GitVersioning](https://www.nuget.org/packages/Nerdbank.GitVersioning/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrippwill%2Fsharp-meta","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftrippwill%2Fsharp-meta","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrippwill%2Fsharp-meta/lists"}