Pekspro.BuildInformationGenerator
0.2.0
dotnet add package Pekspro.BuildInformationGenerator --version 0.2.0
NuGet\Install-Package Pekspro.BuildInformationGenerator -Version 0.2.0
<PackageReference Include="Pekspro.BuildInformationGenerator" Version="0.2.0" />
paket add Pekspro.BuildInformationGenerator --version 0.2.0
#r "nuget: Pekspro.BuildInformationGenerator, 0.2.0"
// Install Pekspro.BuildInformationGenerator as a Cake Addin
#addin nuget:?package=Pekspro.BuildInformationGenerator&version=0.2.0
// Install Pekspro.BuildInformationGenerator as a Cake Tool
#tool nuget:?package=Pekspro.BuildInformationGenerator&version=0.2.0
This project simplifies the process of adding build information to your .NET projects. It uses a source generator to embed details like build time, commit ID and branch directly into your code.
By default, the values are faked in debug mode. This can be changed in the [BuildInformation]
attribute with the FakeIfDebug
property.
Usage
Create a new partial class in your project and add the [BuildInformation]
(from the Pekspro.BuildInformationGenerator
namespace) attribute and define which information you want. For example:
[BuildInformation(AddBuildTime = true, AddGitCommit = true)]
partial class MyBuildInformation
{
}
Constants will automatically be added to this class that you can use like this:
Console.WriteLine($"Build time: {MyBuildInformation.BuildTime}");
Console.WriteLine($"Commit id: {MyBuildInformation.Git.CommitId}");
Installation
Add the package to your application with:
dotnet add package Pekspro.BuildInformationGenerator
This adds a <PackageReference>
to your project. It's recommended that you also add the attributes PrivateAssets
and ExcludeAssets
like below to exclude the source generator to your final assembly:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>
<PackageReference Include="Pekspro.BuildInformationGenerator" Version="0.2.0"
PrivateAssets="all" ExcludeAssets="runtime" />
</Project>
Setting PrivateAssets="all"
means any projects referencing this one won't get a reference to the Pekspro.BuildInformationGenerator package.
Setting ExcludeAssets="runtime"
ensures the Pekspro.BuildInformationGenerator.Attributes.dll file is not copied to your build output (it is not required at runtime).
Links
You can find more information and can report issues on GitHub.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net451 is compatible. net452 was computed. net46 was computed. net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
0.2.0 | 91 | 6/22/2024 |
0.2.0-preview02 | 57 | 6/22/2024 |
0.2.0-preview01 | 51 | 6/22/2024 |
0.1.0 | 88 | 6/18/2024 |
0.0.1-preview10 | 71 | 6/18/2024 |
0.0.1-preview09 | 75 | 6/16/2024 |
0.0.1-preview08 | 67 | 6/16/2024 |
0.0.1-preview07 | 67 | 6/15/2024 |
0.0.1-preview06 | 68 | 6/15/2024 |
0.0.1-preview05 | 71 | 6/15/2024 |
0.0.1-preview04 | 65 | 6/14/2024 |
0.0.1-preview03 | 79 | 6/11/2024 |
0.0.1-preview02 | 74 | 6/11/2024 |
0.0.1-preview01 | 80 | 6/10/2024 |