Building .NET 5.0 project Azure DevOps pipeline

Yes, Azure DevOps Pipelines can build net5.0 apps.

If you are building with ".Net Core" (DotNetCoreCLI in yaml) task - add "Use .NET Core" (UseDotNet in yaml) task before it, with correct version:

- task: UseDotNet@2
  inputs:
    packageType: 'sdk'
    version: '5.0.x'

- task: DotNetCoreCLI@2
  displayName: 'dotnet build'
  inputs:
    command: 'build'

It's supported.

Since you are using .Net 5, instead of using Nuget restore, try to use Use .net core taskand Dotnet core task with restore command.

- task: UseDotNet@2
  displayName: 'Use .NET Core sdk 5.0.100'
  inputs:
    packageType: 'sdk'
    version: '5.0.100'
    includePreviewVersions: true

- task: DotNetCoreCLI@2
  displayName: 'dotnet restore'
  inputs:
    command: restore
    projects: '**/*.csproj'

It's strongly recommended to use dotnet restore and dotnet build tasks for projects that target .net core. See this statement from Nuget task:

Also take a look at this similar question here: Azure CI pipeline for Blazor .NET 5 doesn't work