Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

ADO Pipeline – Restore Packages for DotNet 6

I have a dotnet solution containing test and library projects + an Azure Functions project.

I’ve updated all nuget packages to the latest versions and set the Azure Functions project to

<TargetFramework>net6.0</TargetFramework>
<AzureFunctionsVersion>v4</AzureFunctionsVersion>

In VS2022 everything now builds ok and all the tests pass.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

However, when my Azure DevOps build pipeline runs its nuget restore task, I get lots of errors about various package incompatibility with net60 such as:

Package Serilog.Extensions.Hosting 4.1.2 is not compatible with net60 (.NETFramework,Version=v6.0).

The yaml for the restore task of the build pipeline is:

- task: NuGetCommand@2
  displayName: Restore
  inputs:
    command: 'restore'
    restoreSolution: '**/*.sln'
    feedsToUse: 'select'

The build pipeline is set to run with:

jobs:
job: Build
displayName: Build
pool:
  vmImage: 'windows-latest'

Anyone explain why the solution would restore and build ok on my laptop but fail in pipeline?

>Solution :

The default version of nuget embedded on the agent should not support your project.
I advise you to use the task "NuGet tool installer" with the version you use on your computer before doing your nuget restore.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading