How To automatically Track Build Number?

So I’m trying to update a text file with the build number saved in it every time i compile visual studio but don’t know how to go about that, ive followed this post [TIP] Generating Game Build numbers for your project - C++ - Unreal Engine Forums but it doesn’t seem to work, can anybody point me into the right direction

thanks in advance