Git Product home page Git Product logo

stamp's Introduction

Icon

This is an add-in for Fody

Stamps an assembly with git data.

The nuget package NuGet Status

https://nuget.org/packages/Stamp.Fody/

PM> Install-Package Stamp.Fody

What it does

Extracts the git information from disk, combines it with the assembly version, and places it in the AssemblyInformationalVersionAttribute.

So if your assembly version is 1.0.0.0, the working branch is "master" and the last commit is 759e9ddb53271dfa9335a3b27e452749a9b22280 then the following attribute will be added to the assembly.

[assembly: AssemblyInformationalVersion("1.0.0.0 Head:'master' Sha:759e9ddb53271dfa9335a3b27e452749a9b22280")]

Templating the version

You can customize the string used in the AssemblyInformationalVersionAttribute by adding some tokens to the string, which Stamp will replace.

For example, if you add [assembly: AssemblyInformationalVersion("%version% Branch=%branch%")] then Stamp will change it to [assembly: AssemblyInformationalVersion("1.0.0.0 Branch=master")]

The tokens are:

  • %version% is replaced with the version (1.0.0.0)
  • %version1% is replaced with the major version only (1)
  • %version2% is replaced with the major and minor version (1.0)
  • %version3% is replaced with the major, minor, and revision version (1.0.0)
  • %version4% is replaced with the major, minor, revision, and build version (1.0.0.0)
  • %githash% is replaced with the SHA1 hash of the branch tip of the repository
  • %shorthash% is replaced with the first eight characters of %githash%
  • %branch% is replaced with the branch name of the repository
  • %haschanges% is replaced with the string defined in the ChangeString attribute in the configuration, see below.

NOTE: if you already have an AssemblyInformationalVersion attribute and it doesn't use replacement tokens, it will not be modified at all.

Configuration

All config options are attributes of Stamp in FodyWeavers.xml

ChangeString

Define the string used to indicate that the code was built from a non clean repository.

Default is HasChanges

<Fody ChangeString="New text" />

UseProjectGit

Define if you want to start Stamp to start searching for the Git repository in the ProjectDir (true) or the SolutionDir (false).

Default is false

<Fody UseProjectGit='true' />

Icon

Stamp designed by Rohith M S from The Noun Project

stamp's People

Contributors

davidalpert avatar distantcam avatar kzu avatar ldv2001 avatar qmfrederik avatar simoncropp avatar yufeih avatar yura-yaroshevich avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.