Setup a Reference variable in azure devops Build Pipeline. It will work as refernce key to change version in build.
Get the Personal Access Token from Settings with Read and Write Permissions.
Install Extension into your organization.
Add Extension into Buidl Agent Job and select Path of csproj you want to get version and increment it.
Use the variable name in Version Variable name field.
Use your azure devops access token in Personal Access Token field.
How it works
Every time build runs it will get the version tag value from csproj selected in the field.
It compares against the value we have the variable we selected.
a. If variable value is greter than or equal to value in csporj it will increment the patch version and save the value in Varible we selected.
b. If Version value in the file is greter than varible value than it will use the file value and update the Variable value in build pipeline.
Where it will help
If you want to increment the path version with 1 every time build runs.
Major and Minor version are controlled by csproj file, if you made a bigger change and want to change minor and major version, you can change it in csproj file, It will detect and that value and use as version value and store for next path patch version.