{"id":17008446,"url":"https://github.com/linkdotnet/buildinformation","last_synced_at":"2025-03-22T16:30:57.095Z","repository":{"id":146779940,"uuid":"618145432","full_name":"linkdotnet/BuildInformation","owner":"linkdotnet","description":"A .NET Source Generator that can give you some valuable information about the build.","archived":false,"fork":false,"pushed_at":"2024-10-24T22:11:28.000Z","size":82,"stargazers_count":15,"open_issues_count":2,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-10-24T22:31:56.497Z","etag":null,"topics":["buildinfo","dotnet","sourcegenerator"],"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/linkdotnet.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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,"publiccode":null,"codemeta":null}},"created_at":"2023-03-23T21:04:34.000Z","updated_at":"2024-10-24T04:51:03.000Z","dependencies_parsed_at":null,"dependency_job_id":"755491fa-0ede-46ae-8dd2-7aff8ba7d243","html_url":"https://github.com/linkdotnet/BuildInformation","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linkdotnet%2FBuildInformation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linkdotnet%2FBuildInformation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linkdotnet%2FBuildInformation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linkdotnet%2FBuildInformation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/linkdotnet","download_url":"https://codeload.github.com/linkdotnet/BuildInformation/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244728201,"owners_count":20500023,"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":["buildinfo","dotnet","sourcegenerator"],"created_at":"2024-10-14T05:28:19.112Z","updated_at":"2025-03-22T16:30:56.666Z","avatar_url":"https://github.com/linkdotnet.png","language":"C#","readme":"# Incremental Build Information Generator\n\n[![.NET](https://github.com/linkdotnet/BuildInformation/actions/workflows/dotnet.yml/badge.svg)](https://github.com/linkdotnet/BuildInformation/actions/workflows/dotnet.yml)\n[![Nuget](https://img.shields.io/nuget/dt/LinkDotNet.BuildInformation)](https://www.nuget.org/packages/LinkDotNet.BuildInformation/)\n[![GitHub tag](https://img.shields.io/github/v/tag/linkdotnet/BuildInformation?include_prereleases\u0026logo=github\u0026style=flat-square)](https://github.com/linkdotnet/BuildInformation/releases)\n\nThis project provides a simple and easy-to-use C# source generator that embeds build information, such as the build time, platform, warning level, and configuration, directly into your code. By using the `BuildInformation` class, you can quickly access and display these details.\n\n## Features\n* Embeds build date (in UTC) in your code\n* Embeds platform (AnyCPU, x86, x64, ...) information in your code\n* Embeds compiler warning level in your code\n* Embeds build configuration (e.g., Debug, Release) in your code\n* Embeds the assembly version and assembly file version in your code\n* Embeds the target framework moniker in your code\n* Embeds the nullability analysis level in your code\n* Embeds the deterministic build flag in your code\n* Embeds the project path where the generator is running in your code\n* Embeds the language and language version (like \"C#\" and \"12.0\")\n\n## Configuration\nBy default the created class is `internal` and is not under any namespace. This can be changed by adding the following to your project file:\n```xml\n\u003cPropertyGroup\u003e\n    \u003cUseRootNamespaceForBuildInformation\u003etrue\u003c/UseRootNamespaceForBuildInformation\u003e\n\u003c/PropertyGroup\u003e\n\n\u003cItemGroup\u003e\n    \u003cCompilerVisibleProperty Include=\"UseRootNamespaceForBuildInformation\" /\u003e\n\u003c/ItemGroup\u003e\n```\n\nThis will use the root namespace of the project for the generated class. This is especially helpful if the generator is used in multiple projects, that might be visible to each other.\n\nThe `AllowProjectDirectoryBuildOutput` property is used to allow the generator to write the project directory into the generated class. This is disabled by default, as it might leak sensitive information.\n```xml\n\u003cPropertyGroup\u003e\n    \u003cAllowProjectDirectoryBuildOutput\u003etrue\u003c/AllowProjectDirectoryBuildOutput\u003e\n\u003c/PropertyGroup\u003e\n\n\u003cItemGroup\u003e\n    \u003cCompilerVisibleProperty Include=\"AllowProjectDirectoryBuildOutput\" /\u003e\n\u003c/ItemGroup\u003e\n```\n\n### Git Information\nBy default, the generator does not include git information. If you want to include the git information, you can add the following to your project file:\n\n```xml\n\u003cPropertyGroup\u003e\n    \u003cIncludeGitInformation\u003etrue\u003c/IncludeGitInformation\u003e\n\u003c/PropertyGroup\u003e\n\n\u003cItemGroup\u003e\n    \u003cCompilerVisibleProperty Include=\"IncludeGitInformation\" /\u003e\n\u003c/ItemGroup\u003e\n```\n\nThis will fill the `GitInformation` class with the following properties:\n```csharp\nConsole.WriteLine(\"Git information:\");\nConsole.WriteLine($\"Branch: {GitInformation.Branch}\");\nConsole.WriteLine($\"Commit: {GitInformation.Commit}\");\nConsole.WriteLine($\"Short commit: {GitInformation.ShortCommit}\");\nConsole.WriteLine($\"Nearest tag: {GitInformation.NearestTag}\");\nConsole.WriteLine($\"Detailed tag description: {GitInformation.DetailedTagDescription}\");\n```\n\nThis will spawn a `git` process to get the information. \nTherefore, git has to be accessible from the command line. Be advised, that it will increase your build time slightly.\n\n## Usage\nTo use the `BuildInformation` class in your project, add the NuGet package:\n\n```no-class\ndotnet add package LinkDotNet.BuildInformation\n```\n\nHere is some code how to use the class:\n```csharp\nusing System;\n\nConsole.WriteLine($\"Build at: {BuildInformation.BuildAt}\");\nConsole.WriteLine($\"Platform: {BuildInformation.Platform}\");\nConsole.WriteLine($\"Warning level: {BuildInformation.WarningLevel}\");\nConsole.WriteLine($\"Configuration: {BuildInformation.Configuration}\");\nConsole.WriteLine($\"Assembly version: {BuildInformation.AssemblyVersion}\");\nConsole.WriteLine($\"Assembly file version: {BuildInformation.AssemblyFileVersion}\");\nConsole.WriteLine($\"Assembly name: {BuildInformation.AssemblyName}\");\nConsole.WriteLine($\"Target framework moniker: {BuildInformation.TargetFrameworkMoniker}\");\nConsole.WriteLine($\"Nullability level: {BuildInformation.Nullability}\");\nConsole.WriteLine($\"Deterministic build: {BuildInformation.Deterministic}\");\nConsole.WriteLine($\"Analysis level: {BuildInformation.AnalysisLevel}\");\nConsole.WriteLine($\"Project directory: {BuildInformation.ProjectDirectory}\");\nConsole.WriteLine($\"Language: {BuildInformation.Language}\");\nConsole.WriteLine($\"Language version: {BuildInformation.LanguageVersion}\");\n```\n\nYou can also hover over the properties to get the currently held value (xmldoc support). An example output could look like this:\n```no-class\nBuild at: 24.03.2024 21:32:17\nPlatform: AnyCpu\nWarning level: 7\nConfiguration: Debug\nAssembly version: 1.0\nAssembly file version: 1.2\nAssembly name: LinkDotNet.BuildInformation.Sample\nTarget framework moniker: net7.0\nNullability level: enabled\nDeterministic build: true\nAnalysis level: 7.0\nProject directory: /Users/example/repo/this/Sample.csproj\nLanguage: C#\nLangugage version: 12.0\n```\n\n## Contributing\nIf you would like to contribute to the project, please submit a pull request or open an issue on the project's GitHub page. We welcome any feedback, bug reports, or feature requests.\n\n## License\nThis project is licensed under the MIT License.","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flinkdotnet%2Fbuildinformation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flinkdotnet%2Fbuildinformation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flinkdotnet%2Fbuildinformation/lists"}