I found the solution:
1) You need to get access to your Build Agent machine
2) Navigate to where the Build Agent is installed.
For me --> C:\BuildAgent\tasks\NuGetPackager
3) You will see folder versions, so go into the latest one.
4) Modify the PowerShell script, NuGetPackager.ps1
Find --> $VersionRegex = "\d+.\d+.\d+.\d+"
And replace with --> $VersionRegex = "\d+.\d+.\d+.\d+|\d+.\d+.\d+"
5) And then save the script.
What I am doing is modifying the regular expression to say "Search for the pattern #.#.#.# OR #.#.# in the build number string". Whereas before it was only looking for "#.#.#.#".
Now, when you do your build, the TFS Build Agent will be able parse the build version:
Set workingFolder to default: C:\BuildAgent\tasks\NuGetPackager\0.1.58
Executing the powershell script: C:\BuildAgent\tasks\NuGetPackager\0.1.58\NuGetPackager.ps1
Getting version number from build
BUILD_BUILDNUMBER: Planning.Domain.Library-CI_1.0.7
Version: 1.0.7