{"id":25239744,"url":"https://github.com/netlah/abstractions","last_synced_at":"2025-10-26T15:30:36.216Z","repository":{"id":47679481,"uuid":"365420725","full_name":"NetLah/abstractions","owner":"NetLah","description":"Classes for retrieving .NET assembly build time ApplicationInfo, AssemblyInfo","archived":false,"fork":false,"pushed_at":"2024-03-20T06:47:09.000Z","size":120,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-02-10T23:46:48.465Z","etag":null,"topics":["application-info","aspnetcore","assembly","assembly-build-datetime","assembly-info","build","build-datetime","diagnostics","dotnet","netcore"],"latest_commit_sha":null,"homepage":"","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/NetLah.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"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}},"created_at":"2021-05-08T04:45:42.000Z","updated_at":"2022-09-13T16:58:16.000Z","dependencies_parsed_at":"2023-11-24T09:24:25.189Z","dependency_job_id":"aa628bdb-a6a1-4f7b-8fb7-f835f656c5ea","html_url":"https://github.com/NetLah/abstractions","commit_stats":{"total_commits":65,"total_committers":1,"mean_commits":65.0,"dds":0.0,"last_synced_commit":"fc078ac9d4b44c8189647c2b4653f7883c5abaf1"},"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NetLah%2Fabstractions","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NetLah%2Fabstractions/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NetLah%2Fabstractions/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NetLah%2Fabstractions/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NetLah","download_url":"https://codeload.github.com/NetLah/abstractions/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238353538,"owners_count":19457857,"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":["application-info","aspnetcore","assembly","assembly-build-datetime","assembly-info","build","build-datetime","diagnostics","dotnet","netcore"],"created_at":"2025-02-11T19:00:06.446Z","updated_at":"2025-10-26T15:30:35.908Z","avatar_url":"https://github.com/NetLah.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NetLah.Abstractions - .NET Library\n\n[NetLah.Abstractions](https://www.nuget.org/packages/NetLah.Abstractions/) is .NET library of reusable classes for retrieving .NET assembly build time `ApplicationInfo`, `AssemblyInfo`.\n\n[NetLah.AssemblyInfo.BuildTime.Target](https://www.nuget.org/packages/NetLah.AssemblyInfo.BuildTime.Target/) is MSBuild target for assembly build-time generation.\n\n## Nuget package\n\n[![NuGet](https://img.shields.io/nuget/v/NetLah.Abstractions.svg?style=flat-square\u0026label=nuget\u0026colorB=00b200)](https://www.nuget.org/packages/NetLah.Abstractions/)\n\n[![NuGet](https://img.shields.io/nuget/v/NetLah.AssemblyInfo.BuildTime.Target.svg?style=flat-square\u0026label=nuget\u0026colorB=00b200)](https://www.nuget.org/packages/NetLah.AssemblyInfo.BuildTime.Target/)\n\n## Build Status\n\n[![Build Status](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Factions-badge.atrox.dev%2FNetLah%2Fabstractions%2Fbadge%3Fref%3Dmain\u0026style=flat)](https://actions-badge.atrox.dev/NetLah/abstractions/goto?ref=main)\n\n## Getting started\n\nThis solution come from the idea of [Gérald Barré on Meziantou's blog Getting the date of build of a .NET assembly at runtime](https://www.meziantou.net/getting-the-date-of-build-of-a-dotnet-assembly-at-runtime.htm)\n\n### 1. Add/Update PackageReference to .csproj\n\n```xml\n\u003cItemGroup\u003e\n  \u003cPackageReference Include=\"NetLah.Abstractions\" Version=\"1.0.0\" /\u003e\n  \u003cPackageReference Include=\"NetLah.AssemblyInfo.BuildTime.Target\" Version=\"1.0.0\" PrivateAssets=\"All\" /\u003e\n\u003c/ItemGroup\u003e\n```\n\n### 2. Output during build\n\n```txt\nMicrosoft (R) Build Engine version 17.0.0+c9eb9dd64 for .NET\nCopyright (C) Microsoft Corporation. All rights reserved.\n\n  Determining projects to restore...\n  All projects are up-to-date for restore.\n  SampleApp -\u003e C:\\Work\\NetLah\\abstractions\\samples\\SampleApp\\bin\\Debug\\net6.0\\SampleApp.dll\n  SampleApp [buildTime] := 2021-11-08T21:26:28 (net6.0)\n\nBuild succeeded.\n    0 Warning(s)\n    0 Error(s)\n\nTime Elapsed 00:00:01.84\n```\n\n### 2. Retrieve build datetime of assembly\n\n```csharp\nvar asm = new AssemblyInfo(typeof(AssemblyInfo).Assembly);\nConsole.WriteLine($\"AssemblyTitle:{asm.Title}\");\nConsole.WriteLine($\"Version:{asm.InformationalVersion} BuildTime:{asm.BuildTimestampLocal}; Framework:{asm.FrameworkName}\");\n```\n\nThe output:\n\n```text\nAssemblyTitle:NetLah.Abstractions\nVersion:0.2.0-rc2.2 BuildTime:2021-11-08T21:26:28+08:00; Framework:.NETStandard,Version=v2.0\n```\n\n### 3. Or Retrieve build datetime of entry assembly\n\n```csharp\nvar appInfo = ApplicationInfo.Initialize(null);\nConsole.WriteLine($\"AppTitle:{appInfo.Title}\");\nConsole.WriteLine($\"Version:{appInfo.InformationalVersion} BuildTime:{appInfo.BuildTimestampLocal};Framework:{appInfo.FrameworkName}\");\n```\n\nOutput:\n\n```text\nAppTitle:SampleApp\nVersion:0.2.0-rc2.2 BuildTime:2021-11-08T21:26:56+08:00; Framework:.NETCoreApp,Version=v6.0\n```\n\n### 4. Use `Directory.Build.targets` to declare build date time attribute to all projects inside the solution\n\n- Set build date time to projects that already include packageReference `NetLah.AssemblyInfo.BuildTime.Target`\n\n```xml\n\u003cItemGroup\u003e\n  \u003cPackageReference Update=\"NetLah.Abstractions\" Version=\"1.0.0\" /\u003e\n  \u003cPackageReference Update=\"NetLah.AssemblyInfo.BuildTime.Target\" Version=\"1.0.0\" PrivateAssets=\"All\" /\u003e\n\u003c/ItemGroup\u003e\n```\n\n- Set build date time to all projects\n\n```xml\n\u003cItemGroup\u003e\n  \u003cPackageReference Update=\"NetLah.Abstractions\" Version=\"1.0.0\" /\u003e\n  \u003cPackageReference Include=\"NetLah.AssemblyInfo.BuildTime.Target\" Version=\"1.0.0\" PrivateAssets=\"All\" /\u003e\n\u003c/ItemGroup\u003e\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnetlah%2Fabstractions","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnetlah%2Fabstractions","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnetlah%2Fabstractions/lists"}