BuildDateTimeGeneratorAlt 2.0.1

dotnet add package BuildDateTimeGeneratorAlt --version 2.0.1
                    
NuGet\Install-Package BuildDateTimeGeneratorAlt -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="BuildDateTimeGeneratorAlt" Version="2.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="BuildDateTimeGeneratorAlt" Version="2.0.1" />
                    
Directory.Packages.props
<PackageReference Include="BuildDateTimeGeneratorAlt" />
                    
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 BuildDateTimeGeneratorAlt --version 2.0.1
                    
#r "nuget: BuildDateTimeGeneratorAlt, 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 BuildDateTimeGeneratorAlt@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=BuildDateTimeGeneratorAlt&version=2.0.1
                    
Install as a Cake Addin
#tool nuget:?package=BuildDateTimeGeneratorAlt&version=2.0.1
                    
Install as a Cake Tool

BuildDateTime Generator (Alternate)

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.

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.

This code was adapted from the BuildDateTime generator and modified to work with apps that generate Program.cs

There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

  • .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
2.0.1 94 2/12/2026
2.0.0 87 2/12/2026