Fixed Assembly Version with Auto Incremented File Version?

后端 未结 1 788
陌清茗
陌清茗 2021-02-04 14:33

I\'m trying to find a more meaningful way to handle versioning for my app and I came acrossed this KB article

http://support.microsoft.com/kb/556041

Basically it

1条回答
  •  不知归路
    2021-02-04 14:52

    Yes it's a bit silly, Microsoft seems to have got it the wrong way round. AssemblyVersion is used in the .NET assembly versioning system, so you should never auto-increment it, but AssemblyFileVersion is written to the file version entry in the file's version resource, so you might reasonably expect it to always auto-increment by default.

    I'm sure that there are some 3rd party build systems out there that can do this for you, but I just wrote a little command line C# app to do it, and it gets run on every project as part of our build process. It's very straightforward:

    1. Read the AssemblyInfo.cs file line by line.
    2. Do a RegEx search for the AssemblyFileVersion line, capturing all four version parts into separate capture groups. You could parse it yourself, but a regex will do all the detecting and parsing in one go, so it seems silly not to take advantage.
    3. Once you have the four integers, implement your own incrementing logic as you see fit.

    0 讨论(0)
提交回复
热议问题