Skip to content

TimeWarpEngineering/timewarp-build-tasks

Repository files navigation

Stars Forks License Issues Open

nuget nuget

Twitter Dotnet

Discord Twitter Twitter

logo

TimeWarp.Build.Tasks

TimeWarp.Build.Tasks is an MSBuild tasks library that provides build-time automation for .NET projects. The library automatically injects git metadata (commit hash and timestamp) into your assemblies at build time, enabling better traceability and versioning in production deployments.

This build-time dependency integrates seamlessly into your build pipeline without adding runtime overhead, making it ideal for CI/CD workflows and production builds where tracking exact source versions is critical.

Give a Star! ⭐

If you find this project useful, please give it a star. Thanks!

Features

  • Automatic Git Metadata Injection - Embeds commit hash and timestamp into assembly metadata
  • Build-Time Only - No runtime dependencies or performance impact
  • Transitive Support - Automatically applied to projects that reference packages using this library
  • Configurable - Can be disabled per-project with TimeWarpEnableGitMetadata=false
  • Fallback Handling - Gracefully handles non-git repositories without breaking builds

Installation

dotnet add package TimeWarp.Build.Tasks

Check out the latest NuGet packages on the TimeWarp Enterprises NuGet page.

Usage

Once installed, git metadata is automatically injected into your assemblies during build. Access the metadata at runtime:

using System.Reflection;

var assembly = typeof(Program).Assembly;
var commitHash = assembly.GetCustomAttributes<AssemblyMetadataAttribute>()
    .FirstOrDefault(a => a.Key == "CommitHash")?.Value;
var commitDate = assembly.GetCustomAttributes<AssemblyMetadataAttribute>()
    .FirstOrDefault(a => a.Key == "CommitDate")?.Value;

Console.WriteLine($"Built from commit: {commitHash}");
Console.WriteLine($"Commit date: {commitDate}");

Disabling Git Metadata

To disable automatic git metadata injection for a specific project:

<PropertyGroup>
  <TimeWarpEnableGitMetadata>false</TimeWarpEnableGitMetadata>
</PropertyGroup>

Documentation

See full documentation.

Unlicense

License This project is licensed under the Unlicense.

Contributing

Your contributions are welcome! Before starting any work, please open a discussion.

Help with the documentation is also greatly appreciated.

Contact

If you have an issue and don't receive a timely response, feel free to reach out on our Discord server.

Discord

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •  

Languages