BuildDateTimeGenerator 2.0.1

dotnet add package BuildDateTimeGenerator --version 2.0.1
                    
NuGet\Install-Package BuildDateTimeGenerator -Version 2.0.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="BuildDateTimeGenerator" Version="2.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="BuildDateTimeGenerator" Version="2.0.1" />
                    
Directory.Packages.props
<PackageReference Include="BuildDateTimeGenerator" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add BuildDateTimeGenerator --version 2.0.1
                    
#r "nuget: BuildDateTimeGenerator, 2.0.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package BuildDateTimeGenerator@2.0.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=BuildDateTimeGenerator&version=2.0.1
                    
Install as a Cake Addin
#tool nuget:?package=BuildDateTimeGenerator&version=2.0.1
                    
Install as a Cake Tool

BuildDateTime Generator

This simple C# source code generator adds the DateTimeOffset BuildDateTime { get; } property to the compiled project. The property gets the DateTimeOffset value which is set to the date and time the project was built.

Download the package.

The way the property is accessible depends on the project:

1. Main() style entry point application The property is added to the class that contains the Main() method. The class must be marked as partial.

namespace ApplicationNamespace
{
  internal partial class Program
  {
    private static void Main ()
    {
      Console.WriteLine( BuildDateTime );
    }
  }
}

2. Top-level entry point application The property is added to the top-level of the application. The usage is straightforward:

Console.WriteLine( BuildDateTime );

3. Class library The property is added to a new class BuildDateTimeClass in the default namespace of the library.

namespace ClassLibrary
{
  using System;

  public class Class
  {
    public static DateTimeOffset BuildDateTimeUsage { get; } = BuildDateTimeClass.BuildDateTime;
  }
}

📝 Because the value of the BuildDateTime property varies from build to build, the Deterministic option, if set, is violated.

There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

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
2.0.1 241 10/3/2025
1.0.1 328 2/10/2024