Here are two straightforward steps for automatic versioning of a .NET application when using azure pipelines.

First step is to add -p:Version=$(date).$(buildCounter) switch to the dotnet publish (or dotnet build if you don't use publishing) step:

- script: dotnet publish --output $(Build.ArtifactStagingDirectory) -p:Version=$(date).$(buildCounter)
  displayName: 'dotnet publish'

The second one is to declare the variables used in the previous step in variables section. First one is the current date in yyyy.MM.dd format and the second is a build counter (for given date) that is reset everyday.

  buildConfiguration: 'Release'
  date: $[format('{0:yyyy}.{0:MM}.{0:dd}', pipeline.startTime)]
  buildCounter: $[counter(variables['date'], 0)]

Thanks to that msbuild will put a version in current date + build counter format in the assembly (e.g., 2021.7.12.2) that guarantees it will always be unique and incrementing with every build. If that's a Blazor application then you can display this value by using this code:

<span class="small">MyBlazorApp @($"v{GetType().Assembly.GetName().Version}")</span>