Simple unreleased version and BuildDate config
WHAT
This partially implements the automatic pre-release version bumping from #5. It's currently a very simply increment patch + "-alpha".
It also
- Updates the changelog
- Partially updates the readme
- Continues to improve edge-cases and testing, such as only unreleased, no release at all
- Adds a configuration property to disable writing the BuildDate to assembly metadata
WHY
It makes sense to try to prevent accidental publishing under old version numbers.
WHAT NOT
This doesn't do the clever major/minor/patch derivation, nor height.
@baronfel I haven't added the configuration property for the AssemblyBuildDate because I'm not sure I understand why you would use it. Any chance you remember?
The configuration would mostly come in because some people may not want dates of any kind 'stamped' into the assembly - Dates are a common source of non-determinism in builds and so it's common practice to either pin the date to UNIX epoch, omit the date entirely, or via some other means use a consistent date. I think it's safe-ish for this library because we would emit the date that's in the Changelog (and so would be stable), I'm just a bit cautious about dates in binaries in general.
@baronfel Could you check that I've set appropriate BeforeTargets? I had to add something to ensure it all happened before Assembly Attributes were written, but it was a bit of a guess!
To be honest, I'm not entirely sure why it wasn't necessary before, unless the assembly wasn't having the version written to it? Or unspecified ordering getting lucky?
Good point on the timing. There are 4 scenarios we need to care about to make sure all the versions are set at the right times and places:
-
dotnet packof single-TFM project -
dotnet packof multi-TFM project -
dotnet buildof project (single or multi-TFM, doesn't matter since the artifacts from build are inherently single-TFM) -
dotnet buildof a project that references a project using this library (to ensure that building the referenced project computes versions correctly before that referenced project is used by the main project)
@baronfel I've added testing for BuildDate + config, so I think this PR is ready. I'll look into the more sophisticated version bumping, and maybe creating a test solution with the different combinations. I'm going on holiday at the end of this week though, so that might not be imminent :)