简体   繁体   中英

.net core 3.1 Azure devops Pipeline failed on nuget restore

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:

在此处输入图像描述

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM