Replies: 1 comment
-
The main problem that computing that property presents is that the console apps (both the one used internally by the MinVer MSBuild task and the minver-cli dotnet tool) currently return a single string value—the version. They have no facility to return structured data consisting of more than a single literal, e.g a version and a previous version, and I'm not sure I want to introduce that complexity. Another way to do this would be to write a custom target to make MinVer run in the context of the commit prior to the current commit, store the value of Pseudo-code: <Target Name="MyTarget" BeforeTargets="MinVer">
If there is a commit prior to the current commit
git checkout HEAD^
set MinVerIgnoreHeight to true
run the MinVer target
set MinVerIgnoreHeight to false
git checkout @{-1}
store the value of MinVerVersion in MinVerVersionPrevious
</Target> This assume you are currently not setting <Target Name="MyTarget" BeforeTargets="MinVer">
If there is a commit prior to the current commit
store the current commit sha
If MinVerIgnoreHeight is true
run the MinVer target
git checkout MinVerVersion
else
git checkout HEAD^
store the original value of MinVerIgnoreHeight
set MinVerIgnoreHeight to true
run the MinVer target
set MinVerIgnoreHeight to the original value
git checkout {original commit sha}
store the value of MinVerVersion in MinVerVersionPrevious
</Target> You may also have to do something to cater for the edge case of not having any tag in the commit history. |
Beta Was this translation helpful? Give feedback.
-
Hi,
I've been successfully using both MinVer (fantastic tool btw) and .NET Package Validation to check for breaking changes when running
dotnet pack
.I've been manually updating the
PackageValidationBaselineVersion
property after each release, but I just realized I always just want to keep this in sync with the last package version.Currently, MinVer sets
$(Version)
and$(PackageVersion)
, but I think I would need something like$(PreviousPackageVersion)
to automate this.Wouldn't it be possible to make this a computed property using MinVer build tasks?
Beta Was this translation helpful? Give feedback.
All reactions