@@ -4,11 +4,12 @@ using a Constrained Semantic Version ([CSemVer](https://csemver.org/)).
44
55> [ !WARNING]
66> As a [ Breaking change in .NET SDK 8] ( https://learn.microsoft.com/en-us/dotnet/core/compatibility/sdk/8.0/source-link )
7- > is now setting the build meta data for the ` InformationalVersion ` property without user
8- > consent. (A Highly controversial choice that was more easily handled via an OPT-IN pattern)
9- > Unfortunately, this was set ON by default and made into an 'OPT-OUT' scenario. This library
10- > will honor such a setting and does not alter/interfere with it in any way. (Though the results
11- > can, unfortunately, produce surprising behavior).
7+ > is now setting the build meta data for the ` InformationalVersion ` property automatically and
8+ > without user consent. (A Highly controversial choice that was more easily handled via an
9+ > OPT-IN pattern) Unfortunately, this was set ON by default and made into an 'OPT-OUT' scenario.
10+ > This library will honor such a setting and does not alter/interfere with it in any way.
11+ > (Though the results can, unfortunately, produce surprising behavior as it is not well
12+ > documented).
1213>
1314> If you wish to disable this behavior you can set an MSBUILD property to OPT-OUT as follows:
1415> ` <IncludeSourceRevisionInInformationalVersion>false</IncludeSourceRevisionInInformationalVersion> `
@@ -17,11 +18,12 @@ using a Constrained Semantic Version ([CSemVer](https://csemver.org/)).
1718> who are aware of the change and those who use this library to set an explicit build meta data
1819> string. (Principle of least surprise for what this library can control).
1920>
20- > The default .NET build behavior is to use the Repository ID (usually a GIT commit hash).
21- > This is appended with a leading ` + ` if one isn't already in the ` InformationalVersion `
22- > property. If build metadata is already included (Like from use of this task) the id is
23- > appended using a ` . ` instead. So it is ALWAYS appended unless the project has opted out of
24- > this behavior by setting the property as previously described.
21+ > The default behavior added in this breaking change is to use the Repository ID (usually a GIT
22+ > commit hash [ FULL SHA form!] ) as the build metadata. This is appended with a leading ` + ` if
23+ > one isn't already in the ` InformationalVersion ` property. If build metadata is already
24+ > included (Like from use of this task) the id is appended using a ` . ` instead. So it is ALWAYS
25+ > appended unless the project has opted out of this behavior by setting the property as
26+ > previously described.
2527>
2628> Thus, it is *** strongly recommended*** that projects using this package OPT-OUT
2729> of the new behavior.
@@ -36,15 +38,15 @@ allowing for automated CI builds. These new versions are called a [Constrained S
3638Version] ( http://csemver.org ) (CSemVer).
3739
3840A CSemVer is unique for each CI build and always increments while still supporting official
39- releases. In the real world there are often cases where there are additional builds that are distinct from
40- official releases and CI builds. Including Local developer builds, builds generated from a Pull
41- Request (a.k.a Automated buddy build). CSemVer doesn't explicitly define any format for these
42- cases. So this library defines a pattern of versioning that is fully compatible with CSemVer and
43- allows for the additional build types in a way that retains precedence having the least
44- surprising consequences. In particular, local build packages have a higher precedence than CI or
45- release versions if all other components of the version match. This ensures that what you are
46- building includes the dependent packages you just built instead of the last one released
47- publicly.
41+ releases. However, in the real world, there are often cases where there are additional builds
42+ that are distinct from official releases and CI builds. These include local developer builds
43+ and builds generated from a Pull Request (a.k.a Automated buddy build). Neither SemVer, nor
44+ CSemVer explicitly define any format for these cases. So this library defines a pattern of
45+ versioning that is fully compatible with CSemVer and allows for the additional build types
46+ in a way that retains precedence having the least surprising consequences. In particular,
47+ local build versions have a higher precedence than CI or release versions if all other
48+ components of the version match. This ensures that what you are building includes the dependent
49+ components you just built instead of the last one released publicly.
4850
4951The following is a list of the version formats in descending order of precedence:
5052
@@ -56,24 +58,41 @@ The following is a list of the version formats in descending order of precedence
5658| Official PreRelease | ` {BuildMajor}.{BuildMinor}.{BuildPatch}-{PreReleaseName}[.PreReleaseNumber][.PreReleaseFix]+{BuildMeta} ` |
5759| Official Release | ` {BuildMajor}.{BuildMinor}.{BuildPatch}+{BuildMeta} ` |
5860
61+ That is the, CI BuildName is chosen to ensure the ordering matches the expected behavior for
62+ a build.
63+
5964This project provides an MSBUILD task to automate the generation of these versions in an easy
6065to use NuGet Package.
6166
6267The package creates File and Assembly Versions and defines the appropriate MsBuild properties
6368so the build will automatically incorporate them.
6469> ** NOTE:**
65- The automatic use of MsBuild properties requires using the new SDK attribute support for .NET
66- projects. Where the build auto generates the assembly info. If you are using some other means to
67- auto generate the assembly level versioning attributes. You can use the properties generated by
68- this package to generate the attributes.
70+ > The automatic use of MsBuild properties requires using the new SDK attribute support for .NET
71+ > projects. Where the build auto generates the assembly info. If you are using some other means
72+ > to auto generate the assembly level versioning attributes. You can use the properties
73+ > generated by this package to generate the attributes.
6974
7075File and AssemblyVersions are computed based on the CSemVer "Ordered version", which
71- is a 64 bit value that maps to a standard windows FILEVERSION Quad with each part
72- consuming 16 bits. This ensures a strong relationship between the assembly/file versions
76+ is a 64 bit value that maps to a standard windows FILE VERSION Quad with each part
77+ consuming 16 bits. This ensures a strong relationship between the assembly/file versions
7378and the packages as well as ensures that CI builds can function properly. Furthermore, this
7479guarantees that each build has a different file and assembly version so that strong name
7580signing functions properly to enable loading different versions in the same process.
7681
82+ > [ !IMPORTANT]
83+ > A file version quad representation of a CSemVer does NOT carry with it the CI information nor
84+ > the build metadata. It only contains a single bit to indicate a Release vs. a CI build. In
85+ > fact, the official CSemVer specs are silent on the use of this bit though the "playground"
86+ > does indicate an ODD numbered revision is a CI build. However, that leads to problems (see
87+ > this: [ Spec issue] ( https://github.com/CK-Build/csemver.org/issues/2 ) for more details).
88+ > Thus, the ` Ubiquity.NET.Versioning.* ` libraries do NOT work that way. In these libraries,
89+ > an odd numbered revision indicates a RELEASE build whereas an EVEN numbered form represents
90+ > a CI build. This results in the correct behavior for comparisons of the File version. The
91+ > file version comparisons MUST result in correct ordering or an underlying Windows OS and
92+ > related APIs will NOT behave as expected. (A CI build is ALWAYS ordered less then a release
93+ > build)
94+
95+
7796The Major, Minor and Patch versions are only updated in the primary branch at the time
7897of a release. This ensures the concept that SemVer versions define released products. The
7998version numbers used are stored in the repository in the BuildVersion.xml
0 commit comments