To this day, automatic versioning of Windows driver or good ol' .NET Framework projects can be a bit of a hassle, especially in headless CI. I've made the "vpatch" tool for this purpose a while ago, but only recently made it available via NuGet consumption as a "dotnet tool", check it out!
https://github.com/nefarius/vpatch?tab=readme-ov-file#installation