{"id":26243472,"url":"https://github.com/salem84/aspnetcore.versioninfo","last_synced_at":"2025-04-23T13:43:57.557Z","repository":{"id":46580371,"uuid":"338677297","full_name":"salem84/AspNetCore.VersionInfo","owner":"salem84","description":"Get version information of your .NET 6 web application with this simple endpoint middleware ","archived":false,"fork":false,"pushed_at":"2025-03-14T23:41:35.000Z","size":1700,"stargazers_count":2,"open_issues_count":15,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-30T00:11:33.974Z","etag":null,"topics":["aspnet-core","dotnet-core","endpoint","hacktoberfest","middleware","versioning"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/salem84.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2021-02-13T21:54:43.000Z","updated_at":"2025-03-14T23:38:15.000Z","dependencies_parsed_at":"2023-10-03T01:06:57.174Z","dependency_job_id":null,"html_url":"https://github.com/salem84/AspNetCore.VersionInfo","commit_stats":{"total_commits":98,"total_committers":4,"mean_commits":24.5,"dds":0.5102040816326531,"last_synced_commit":"6404d5b1f72a330fa693a848eeae0c52ef0ef489"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/salem84%2FAspNetCore.VersionInfo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/salem84%2FAspNetCore.VersionInfo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/salem84%2FAspNetCore.VersionInfo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/salem84%2FAspNetCore.VersionInfo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/salem84","download_url":"https://codeload.github.com/salem84/AspNetCore.VersionInfo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250441556,"owners_count":21431184,"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":["aspnet-core","dotnet-core","endpoint","hacktoberfest","middleware","versioning"],"created_at":"2025-03-13T10:20:32.340Z","updated_at":"2025-04-23T13:43:57.549Z","avatar_url":"https://github.com/salem84.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![NuGet version](https://img.shields.io/nuget/v/AspNetCore.VersionInfo?color=yellowgreen)](http://www.nuget.org/packages/AspNetCore.VersionInfo) ![.NET](https://img.shields.io/badge/.NET-8.0-blueviolet) [![License](https://img.shields.io/badge/License-Apache%202.0-red.svg)](https://github.com/salem84/AspNetCore.VersionInfo/blob/master/LICENSE) [![Coverage](https://sonarcloud.io/api/project_badges/measure?project=salem84_AspNetCore.VersionInfo\u0026metric=coverage)](https://sonarcloud.io/dashboard?id=salem84_AspNetCore.VersionInfo)\n[![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=salem84_AspNetCore.VersionInfo\u0026metric=security_rating)](https://sonarcloud.io/dashboard?id=salem84_AspNetCore.VersionInfo)\n[![Reliability Rating](https://sonarcloud.io/api/project_badges/measure?project=salem84_AspNetCore.VersionInfo\u0026metric=reliability_rating)](https://sonarcloud.io/dashboard?id=salem84_AspNetCore.VersionInfo)\n\n# AspNetCore.VersionInfo\n\nAspNetCore.VersionInfo is a library to expose information about assembly versions used in your web application. \nIn particular there are three endpoints, which returns:\n* a JSON-formatted data (_/version/json_)\n* an HTML user-friendly page (_/version/html_)\n* a nice badge image (_/version/badge_)\n\nLibrary offers some in-bundle providers to capture versions information, such as the version of entry assembly or the version of the common language runtime. A typical JSON output is: \n\n```js\n{\n    \"RuntimeInformation.FrameworkDescription\":\".NET 6.0.8\",\n    \"EntryAssemblyVersion\":\"2.5.0.0\",\n\n    ...\n}\n```\n\nMoreover it is possible create a specific class to collect additional data as described in [Providers](#providers) section.\n\n## 🧰 Supported Platforms\n\nThis library currently targets `net8.0`\n\n## 📦 Download\n\nPrerelease packages are on [GH Packages](https://github.com/salem84?tab=packages\u0026repo_name=AspNetCore.VersionInfo)\n\nRelease packages are on [Nuget](http://www.nuget.org/packages/AspNetCore.VersionInfo)\n\n## 🚀 Online Demo\n\n|   | URL |\n|---|:-----:|\n|![Win](docs/images/win_med.png) **Windows Web App**| https://aspnetcoreversioninfo-demo.azurewebsites.net | \n|![Win](docs/images/win_med.png) **Windows HTML Endpoint** | [/version/html](https://aspnetcoreversioninfo-demo.azurewebsites.net/version/html) | \n|![Win](docs/images/win_med.png) **Windows JSON Endpoint** | [/version/json](https://aspnetcoreversioninfo-demo.azurewebsites.net/version/json) |\n|![Win](docs/images/win_med.png) **Windows Badge Endpoint** | [![/version/badge](https://aspnetcoreversioninfo-demo.azurewebsites.net/version/badge/RuntimeInformation.RuntimeIdentifier?color=BrightGreen\u0026label=os)](https://aspnetcoreversioninfo-demo.azurewebsites.net/version/badge/RuntimeInformation.RuntimeIdentifier?color=BrightGreen\u0026label=os) | \n| | |\n|![Linux](docs/images/linux_med.png) **Linux Web App**| https://aspnetcoreversioninfo-linux-demo.azurewebsites.net | \n|![Linux](docs/images/linux_med.png) **Linux HTML Endpoint**| [/version/html](https://aspnetcoreversioninfo-linux-demo.azurewebsites.net/version/html) | \n|![Linux](docs/images/linux_med.png) **Linux JSON Endpoint**| [/version/json](https://aspnetcoreversioninfo-linux-demo.azurewebsites.net/version/json) | \n|![Linux](docs/images/linux_med.png) **Linux Badge Endpoint** | [![/version/badge](https://aspnetcoreversioninfo-linux-demo.azurewebsites.net/version/badge/RuntimeInformation.RuntimeIdentifier?color=Red\u0026label=os\u0026icon=simpleicons__debian)](https://aspnetcoreversioninfo-linux-demo.azurewebsites.net/version/badge/RuntimeInformation.RuntimeIdentifier?color=Red\u0026label=os\u0026icon=simpleicons__debian) | \n\n## ⭐ Getting Started\n\n### Startup.cs\n```csharp\npublic class Startup\n{\n    public void ConfigureServices(IServiceCollection services)\n    {\n        services.AddVersionInfo()\n            .With\u003cClrVersionProvider\u003e()\n            .With\u003cAssemblyVersionProvider\u003e();\n    }\n\n    public void Configure(IApplicationBuilder app)\n    {\n        app.UseRouting();\n\n        app.UseEndpoints(endpoints =\u003e\n        {\n            endpoints.MapVersionInfo();\n        });\n    }\n}\n```\n\n## 🔌 Providers\nLibrary is based on following types:\n* Providers, that read information and return data in a dictionary\n* Collector, that aggregates all data from providers and exposes to endpoints.\n\nA Collector implementation is already included in _AspNetCore.VersionInfo_ package, and usually its default implementation is valid for all scenarios. \n\nInstead, in order to enrich data gathered from library, multiple custom providers could be developed, implementing custom classes inherited from `IInfoProvider` interface.\n\nTo show providers' information, they have to be configured in `ConfigureServices` declaration, using `.With\u003cIInfoProvider\u003e` extension method.\n\n### In-bundle providers\n_AspNetCore.VersionInfo_ package includes following providers:\n\n| Provider | Keys | Description |\n| - | - | - |\n| AssemblyVersionProvider  | `EntryAssembly` \u003cbr/\u003e `EntryAssemblyFullName` \u003cbr/\u003e `EntryAssemblyLocation` \u003cbr/\u003e `EntryAssemblyDirectoryPath` \u003cbr/\u003e `EntryAssemblyFileVersion` \u003cbr/\u003e `EntryAssemblyClrVersion` \u003cbr/\u003e `EntryAssemblyCreationDate` \u003cbr/\u003e `EntryAssemblyLastModifiedDate` | Version and main properties of entry assembly |\n| ClrVersionProvider  | `RuntimeInformation.FrameworkDescription` \u003cbr/\u003e `RuntimeInformation.OsDescription` \u003cbr/\u003e `RuntimeInformation.OsArchitecture` \u003cbr/\u003e `RuntimeInformation.ProcessArchitecture` \u003cbr/\u003e `RuntimeInformation.RuntimeIdentifier` | Version of the common language runtime and .NET installation on which the app is running |\n| AppDomainAssembliesVersionProvider  | `\u003cAssemblyName\u003e` | Version of assemblies loaded in App Domain |\n| EnvironmentProvider  | `Environment.Uptime` \u003cbr/\u003e `Environment.OSVersion` \u003cbr/\u003e `Environment.IsOsWindows` \u003cbr/\u003e `Environment.Is64BitOperatingSystem` \u003cbr/\u003e `Environment.Is64BitProcess` \u003cbr/\u003e `Environment.ProcessorCount` \u003cbr/\u003e `Environment.MachineName` \u003cbr/\u003e `Environment.SystemDirectory` \u003cbr/\u003e `Environment.WorkingDirectory` \u003cbr/\u003e `Environment.CommandLine` \u003cbr/\u003e `Environment.DotNetVersion` | Environment properties |\n| EnvironmentVariablesProvider | `\u003cEnvironmentVariableName\u003e`-`\u003cEnvironmentVariableValue\u003e` | Environment variables |\n\n## 🔧 Options\n\n`MapVersionInfo` extension method accepts an optional `VersionInfoOptions` argument to change default URLs:\n\n```csharp\n\npublic void Configure(IApplicationBuilder app)\n{\n    app.UseRouting();\n\n    app.UseEndpoints(endpoints =\u003e\n    {\n        endpoints.MapVersionInfo(o =\u003e\n        {\n            o.HtmlPath = CUSTOM_HTML_URL;\n            o.ApiPath = CUSTOM_JSON_URL;\n        });\n    });\n}\n\n```\n\n\n## 🖼 Badges\n\nBadge image can be obtained with url\n\n`/version/badge/{versionInfoId}`\n\nwhere `{versionInfoId}` is a key returned by providers.\n\nMoreover endpoint accepts following parameters in querystring:\n* `label`: it's the name to show in the image\n* `icon`: the source type and slug for the icon separated by two underscore characters (`__`) such as `simpleicons__linux`. In this version only [Simple Icons](https://simpleicons.org/) type is supported; you can find a list of slugs [here](https://github.com/simple-icons/simple-icons/blob/develop/slugs.md). Icon color is always white.\n* `color`: a string as defined in the colors table or a custom colors in hexadecimal, RGB, HSL.\n\n| Color | String | \n| -     | -      |\n| ![#4c1](https://via.placeholder.com/15/4c1/000000.png?text=+)| BrightGreen |\n| ![#97CA00](https://via.placeholder.com/15/97CA00/000000.png?text=+) | Green |\n| ![#dfb317](https://via.placeholder.com/15/dfb317/000000.png?text=+) | Yellow |\n| ![#a4a61d](https://via.placeholder.com/15/a4a61d/000000.png?text=+) | YellowGreen |\n| ![#fe7d37](https://via.placeholder.com/15/fe7d37/000000.png?text=+) | Orange |\n| ![#e05d44](https://via.placeholder.com/15/e05d44/000000.png?text=+) | Red |\n| ![#007ec6](https://via.placeholder.com/15/007ec6/000000.png?text=+) | Blue |\n| ![#555](https://via.placeholder.com/15/555/000000.png?text=+) | Gray |\n| ![#9f9f9f](https://via.placeholder.com/15/9f9f9f/000000.png?text=+) | LightGray |\n\n## 💿 Examples\n\n| Name | Notes | Repository |\n| -     | -      | - |\n| Basic | Simple .NET 6 WebApplication with built-in endpoints (published in [demo site](https://aspnetcoreversioninfo-demo.azurewebsites.net)) | [💾](./samples/Basic) |\n| CustomOptions | WebApplication with custom configuration for endpoint URLs | [💾](./samples/CustomOptions) | \n| Minimal | WebApplication using Minimal API | [💾](./samples/Minimal) | \n| Authentication | WebApplication leverages the ASP.NET Core Authentication/Authorization features to easily restrict access | [💾](./samples/Authentication) | \n\n\n## 🔑 Security\n\n### Enable Endpoint only in Development mode\nIn order to enable _AspNetCore.VersionInfo_ only in the development environment, change `Configure` method\n\n```cs\npublic void Configure(IApplicationBuilder app, IWebHostEnvironment env)\n{\n    ...\n    \n    app.UseEndpoints(endpoints =\u003e\n    {\n        if (env.IsDevelopment())\n        {\n            endpoints.MapVersionInfo();\n        }\n    });\n    \n    ...\n}\n```\n\n### Authorization Policy on endpoint\n\n```cs\npublic void ConfigureServices(IServiceCollection services)\n{\n    ...\n    \n    services.AddAuthorization(cfg =\u003e\n    {\n        cfg.AddPolicy(name: Constants.VERSIONINFO_USER_POLICY, cfgPolicy =\u003e\n        {\n            cfgPolicy.AddRequirements().RequireAuthenticatedUser();\n            cfgPolicy.AddAuthenticationSchemes(Constants.COOKIE_SCHEME);\n        });\n    });\n    \n    ...\n}\n\n\npublic void Configure(IApplicationBuilder app, IWebHostEnvironment env)\n{\n    ...\n    \n    app.UseEndpoints(endpoints =\u003e\n    {\n        endpoints.MapVersionInfo().RequireAuthorization(Constants.VERSIONINFO_USER_POLICY); ;\n    });\n    \n    ...\n}\n```\n\nFor more information, you can inspect [Authentication example](./samples/Authentication). \n\n## 📄 License\n\n_AspNetCore.VersionInfo_ is [Apache-2.0 licensed](./LICENSE.md)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsalem84%2Faspnetcore.versioninfo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsalem84%2Faspnetcore.versioninfo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsalem84%2Faspnetcore.versioninfo/lists"}