Skip to content

Add support for additional assembly metadata in AssemblyInfo.cs #895

@johncrim

Description

@johncrim

My use-case is that I'd like to include additional git metadata in the assembly on top of AssemblyVersion, AssemblyFileVersion, and AssemblyInformationalVersion. While I can figure out a way to do this outside of GitVersion, this seems like a feature that belongs in GitVersion.

For example, here are some lines that I would like to append to my AssemblyInfo.cs or GlobalAssemblyInfo.cs:

[assembly: AssemblyMetadata("Git.BranchName", "develop")]
[assembly: AssemblyMetadata("Git.Sha", "aafdf7b9087d386666cb8a3d2910447ce765be66")]
[assembly: AssemblyMetadata("BuildHost", "builder2")]
[assembly: AssemblyMetadata("BuildTimestamp", "20160607-18:53:00Z")]

I like these assembly attributes because they're easy to examine across multiple assemblies.

Obviously the git values are already available, and it would be nice to be able to use the existing logic to add/replace these attributes in the *AssemblyInfo.cs files.

There's a case to be made that BuildHost and BuildTimestamp don't belong in gitversion, but given that all the other *AssemblyInfo.cs modification logic is in GitVersion, it would be nice to be able to pass these in too.

I would imagine these names + value formats could be configured using command-line parameters or using the GitVersion.yml file.

I'm willing and interested in implementing this if you think it's something you would accept if well implemented.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions