Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Embed first two bytes of the git commit ID, encoded as an integer in AssemblyInformationalVersion #207

Closed
jobanputra opened this issue Aug 14, 2018 · 3 comments
Labels

Comments

@jobanputra
Copy link

The sample output should in the .NET support documentation has the first two bytes of the git comment ID, encoded as an integer in the AssemblyInformationVersion (pasted below). How do I configure my version.json to get a similar output?

internal sealed partial class ThisAssembly {
    internal const string AssemblyVersion = "1.0";
    internal const string AssemblyFileVersion = "1.0.24.15136";
    internal const string AssemblyInformationalVersion = "1.0.24.15136-alpha+g9a7eb6c819";
    internal const string AssemblyName = "Microsoft.VisualStudio.Validation";
    internal const string PublicKey = @"0024000004800000940000...reallylongkey..2342394234982734928";
    internal const string PublicKeyToken = "b03f5f7f11d50a3a";
    internal const string AssemblyTitle = "Microsoft.VisualStudio.Validation";
    internal const string AssemblyConfiguration = "Debug";
    internal const string RootNamespace = "Microsoft";
}
@AArnott
Copy link
Collaborator

AArnott commented Aug 14, 2018

It's on by default. What are you seeing instead?

@jobanputra
Copy link
Author

version.json

{
  "$schema": "https://raw.githubusercontent.com/AArnott/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json",
  "version": "1.2",
  "assemblyVersion": {
    "precision": "revision"
  }
}

Output

//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:4.0.30319.42000
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

[assembly: System.Reflection.AssemblyVersionAttribute("1.2.1.26893")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.2.1.26893")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.2.1+g0d690a243b")]


internal sealed partial class ThisAssembly {
    internal const string AssemblyVersion = "1.2.1.26893";
    internal const string AssemblyFileVersion = "1.2.1.26893";
    internal const string AssemblyInformationalVersion = "1.2.1+g0d690a243b";
    internal const string AssemblyName = "redacted";
    internal const string AssemblyTitle = "redacted";
    internal const string AssemblyConfiguration = "Debug";
    internal const string RootNamespace = "redacted";
    private ThisAssembly() {
    }
}

@AArnott
Copy link
Collaborator

AArnott commented Aug 15, 2018

I see. The docs are wrong/outdated. NB.GV never puts the 4th integer into the AssemblyInformationalVersion:

https://github.com/AArnott/Nerdbank.GitVersioning/blob/c518c0306a3cdcf467871acdb6fd3430b662e632/src/NerdBank.GitVersioning/VersionOracle.cs#L179-L180

Adding the first two bytes of the commit ID as an integer in the AssemblyInformationalVersion would be redundant because the git commit ID itself can be and is present in that same field.

Closed by c518c03

@AArnott AArnott closed this as completed Aug 15, 2018
AArnott pushed a commit that referenced this issue Sep 14, 2023
Bumps [StyleCop.Analyzers.Unstable](https://github.com/DotNetAnalyzers/StyleCopAnalyzers) from 1.2.0.435 to 1.2.0.507.
- [Release notes](https://github.com/DotNetAnalyzers/StyleCopAnalyzers/releases)
- [Changelog](https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/KnownChanges.md)
- [Commits](https://github.com/DotNetAnalyzers/StyleCopAnalyzers/commits)

---
updated-dependencies:
- dependency-name: StyleCop.Analyzers.Unstable
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants