Search code examples
azureazure-pipelineswebdeployblazor-webassembly.net-5

.Net 5 Azure Pipeline - The SDK 'Microsoft.NET.Sdk.BlazorWebAssembly' specified could not be found


I upgraded our project to .NET 5 and get this error azure pipeline error when building:

The nuget command failed with exit code(1) and error(C:\agent\_work\91\s\src\Main.Blazor\Main.Blazor.csproj : error : C:\Program Files\dotnet\sdk\3.1.401\Sdks\Microsoft.NET.Sdk.BlazorWebAssembly\Sdk not found. Check that a recent enough .NET Core SDK is installed and/or increase the version specified in global.json.

The SDK Microsoft.NET.Sdk.BlazorWebAssembly specified could not be found

This is the task it fails on and .NET 5 has been installed on this machine, anything I could be missing?

- task: NuGetCommand@2
   displayName: 'NuGet Restore'
  inputs:
    command: 'restore'
    restoreSolution: '$(solution)'
    feedsToUse: 'select'
    vstsFeed: '842a57e5-e138-4563-9d88-36c4b1476f72'

Solution

  • It turns out that there are 2 build servers and one of them did not get updated. The task:

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

    was not needed, once the other build server was updated the only other thing left was to update this task to use 5.x and set the CheckLatest to true

    - task: NuGetToolInstaller@1
        inputs:
        versionSpec: 5.x
        checkLatest: true