GitVersionAliases.

GitVersion(ICakeContext) Method

Summary

Retrieves the GitVersion output.

Syntax

[CakeMethodAlias]
public static GitVersion GitVersion(this ICakeContext context)

Examples

Update the assembly info files for the project.

Cake task:

Task("UpdateAssemblyInfo")
    .Does(() =>
{
    GitVersion(new GitVersionSettings {
        UpdateAssemblyInfo = true
    });
});

Get the Git version info for the project using a dynamic repository.

Cake task:

Task("GetVersionInfo")
    .Does(() =>
{
    var result = GitVersion(new GitVersionSettings {
        UserName = "MyUser",
        Password = "MyPassword,
        Url = "http://git.myhost.com/myproject.git"
        Branch = "develop"
        Commit = EnvironmentVariable("MY_COMMIT")
    });
    // Use result for building NuGet packages, setting build server version, etc...
});

Attributes

Type Description
CakeMethodAliasAttribute An attribute used to mark script method aliases.

Parameters

Name Type Description
context ICakeContext The context.

Return Value

Type Description
GitVersion The Git version info.