3
votes

I am trying to create a pipeline for .NET core 3.1 web application and keep running into a problem at NuGet Restore step.

Error is :

Version 3.1.100 of the .NET Core SDK requires at least version 16.3.0 of MSBuild. The current available version of MSBuild is 15.9.21.664. Change the .NET Core SDK specified in global.json to an older version that requires the MSBuild version currently available.

My VS is updated at the latest version, MSBuild installed in dependencies are at 16.6.0 but it looks like it still targets (finds) only 15.9.21.664 and I have no idea why.

My csproj project has these specifications

<Project Sdk="Microsoft.NET.Sdk.Web">

  <PropertyGroup>
    <TargetFramework>netcoreapp3.1</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.Build" Version="16.6.0" />
    <PackageReference Include="Microsoft.Build.Framework" Version="16.6.0" />
    <PackageReference Include="Microsoft.Build.Runtime" Version="16.6.0" />
    <PackageReference Include="Microsoft.Build.Tasks.Core" Version="16.6.0" />
    <PackageReference Include="Microsoft.Build.Utilities.Core" Version="16.6.0" />
  </ItemGroup>

</Project>

If I understand it correctly, global.json is dropped in core 3+ and is sort of replaced by what is in csproj thus it should have right version 16+?

I am also using the step "Use .NET Core SDK 3.x" before NuGet Restore as somebody pointed out in already discussed thread.

Screenshot of my DevOps Pipeline:

enter image description here

I am trying to get into DevOps and Azure...

1
Look in the settings of you pipeline. Which Agent Specification are you using? It is something like ubuntu-16.04 or windows-2019. Try a different is my suggestion.PEK
@PEK Azure pool was set to <Inherit from pipeline> and as I changed it to Azure Pipelines and specification to window-2019 it built successfully. Thank you for the tip, I spent all the time looking for versions of dependencies.Tomáš Tom Haverla
@PEK TomášTomHaverla You could add an answer.starian chen-MSFT

1 Answers

4
votes

As @PEK suggested following fixed my issue: Azure pool was set to and as I changed it to Azure Pipelines and specification to window-2019 it built successfully.