1
votes

I have an Azure Pipeline which is setup to do:

  • Use .NET Core SDK 3.1.x
  • Dotnet restore
  • Dotnet Build
  • Dotnet Publish

Use .NET Core task looks like that and it run before all others mentioned above: enter image description here

All the jobs are executed successfully apart the Dotnet Publish

This job crashes with these errors: enter image description here

AND

[error]Error: The process 'C:\hostedtoolcache\windows\dotnet\dotnet.exe' failed with exit code 1

[warning]Info: Azure Pipelines hosted agents have been updated to contain .Net Core 3.x SDK/Runtime along with 2.2 & 2.1. Unless you have locked down a SDK version for your project(s), 3.x SDK might be picked up which might have breaking behavior as compared to previous versions.

I tried different version variation for Use .NET Core SDK Job, however all of them lead to the same error.

Publish job: enter image description here

Thanks in advance. Appreciate if someone could give me a clue what I might be doing wrong.

2
Are you hosting your own build agent or using the provided one in Azure?DavidG
provided one in AzureGeorge
Why are you not showing the publish task, when that is the one causing the issue?Ian Kemp
Sorry, thought the issue is unlikely with the actual Publish job. Just updated the case with publish jobGeorge
Hint: what is $(buildPlatform) set to?Ian Kemp

2 Answers

1
votes

Found out that issue had nothing to do with the Azure Pipelines, it was caused by the package referenced in my .csproj:

<DotNetCliToolReference Include="Microsoft.DotNet.Xdt.Tools" Version="2.0.0" />

This package has a dependency for .NETCoreApp 2.0

Found that author created a new package: https://www.nuget.org/packages/DotNet.Xdt# https://github.com/nil4/dotnet-transform-xdt

Which is now compatible with .NET Core 3.x

-1
votes

This is what I do to install a specific version of dotnet core:

- task: UseDotNet@2
  inputs:
    packageType: 'sdk'
    version: '3.1.101'

I the only difference I found you have to specify the SDK version exactly of the SDK build. enter image description here