Nemerle macros for insert AssemblyVersion with revision from git
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
GitVersion.Test
GitVersion
.gitignore
GitVersion.sln
README.md
test.cmd

README.md

GeneratedAssemblyVersion - nemerle macro for automate .net assembly version number.

Usage

Replace AssemblyVersion attribute with GeneratedAssemblyVersion macro.

Example:

[assembly: GeneratedAssemblyVersion("$Major.$Minor.$BUILD_NUMBER.0", Defaults(Major="3", Minor="5", BUILD_NUMBER="0"))]

Macro search environment variables Major and Minor and insert them values into assembly version attribute. If Major and Minor not found - use default values. If default vaues is not set comilation error occures. E.g. BUILD_NUMBER can be set by CI server during build and you do not need build time source file generators.

Git special variables

Macro have two special variables: GitTag and GitRev. If not found in environment, macro trying to evaluate them from git repostitory which contains source.

Example:

[assembly: GeneratedAssemblyVersion("$GitTag.0.$GitRevision", Defaults(GitTag="3.0", GitRevision="9999"))]

Unless GitTag or GitRevision environment defined, macro runs "git describe --tags --long" and parse output like "v1.1-42-g23a4f75". 'GitTag' string replaced with 1.1 (digits and dots characters only of the last tag) 'GitRevision' string replaced with 42 (revisions count since last tag)

Assembly version will be "1.1.0.42".