One simple way I did it previously is by reading the current version and increasing it by one, so you get the current version and increment by one using the command line.
With that said, it is possible to do the following for the .net core project:
In your .csproj file, you add the following:
<PropertyGroup>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<Deterministic>false</Deterministic>
</PropertyGroup>
In your code, for instance, in your entry point class, add the following:
using System.Reflection;
[assembly: AssemblyVersion("1.0.*")]
When you build the code, it will get a version like 1.0.8419.40347.

To make more customization, check this article: https://sachabarbs.wordpress.com/2020/02/23/net-core-standard-auto-incrementing-versioning/
In addition, I added this link:
Equivalent to AssemblyInfo in dotnet core/csproj
And I use this exertion as well for Visual Studio:
https://marketplace.visualstudio.com/items?itemName=PrecisionInfinity.AutomaticVersions