GitVersionInformation in SDK-style projects

Created on 24 Jun 2017  路  3Comments  路  Source: GitTools/GitVersion

In 4.0, UpdateAssemblyInfo is false for the new SDK-style projects, which makes sense since the appropriate values can be injected via UpdateVersionProperties.

However, this means that the static GitVersionInformation class is also no longer generated by default, which means SDK-style projects lose the ability to inspect version properties at run-time.

Setting UpdateAssemblyInfo to true works, but it's a pain because you then end up with assembly attribute conflicts, which means you have to add something like this to your project file also:

<GenerateAssemblyFileVersionAttribute>false</GenerateAssemblyFileVersionAttribute>
<GenerateAssemblyInformationalVersionAttribute>false</GenerateAssemblyInformationalVersionAttribute>
<GenerateAssemblyVersionAttribute>false</GenerateAssemblyVersionAttribute>

I'd like to see the generation of GitVersionInformation be controlled separately and be enabled by default even for SDK-style projects.

Is this something that sounds reasonable? I'd be willing to work on this if it sounds like something you'd accept.

Most helpful comment

Looking over those issues and some of the TODOs in the code, here's what I'm thinking of as a plan of attack for this:

  • Move the AssemblyInfo logic from GitVersionExe's AssemblyInfoFileUpdate class and GitVersionTask's UpdateAssemblyInfo class into GitVersionCore

    • Use the templates that are already in GitVersionCore instead of the ones in GitVersionTask

    • Generalize the update code to be able to handle another template type: GitVersionInformation and expose a way to use it from GitVersionExe and GitVersionTask

With that in place, it should be easier to also fix some of the other issues you linked to as well. How does that sound?

All 3 comments

@bording: Thanks, I agree GitVersionInformation has value without Assembly*Info attributes. Perhaps you can take a look at all the other attribute related issues and see whether you can smack a few birds with one stone here? 馃槃

Related issues: #529, #895, #964, #1183, #1214, #1231, #1241.

Looking over those issues and some of the TODOs in the code, here's what I'm thinking of as a plan of attack for this:

  • Move the AssemblyInfo logic from GitVersionExe's AssemblyInfoFileUpdate class and GitVersionTask's UpdateAssemblyInfo class into GitVersionCore

    • Use the templates that are already in GitVersionCore instead of the ones in GitVersionTask

    • Generalize the update code to be able to handle another template type: GitVersionInformation and expose a way to use it from GitVersionExe and GitVersionTask

With that in place, it should be easier to also fix some of the other issues you linked to as well. How does that sound?

@bording: Fantastic! Whole-heartedly supported! 馃槃 馃憤 馃帀

Was this page helpful?
0 / 5 - 0 ratings