0

This is my first time working with pipelines. I have a library repo that is a .NET Standard library intended to be shared with others. I would like a pipeline that builds it and runs the unit test sln.

Currently I have this after selecting ASP.NET from the predefined options for configuring a pipeline.

- main

pool:
  vmImage: 'windows-latest'

variables:
  solution: '**/MyLibrary.sln'
  buildPlatform: 'Any CPU'
  buildConfiguration: 'Release'
steps:
- task: NuGetToolInstaller@1
- task: VSBuild@1
  inputs:
    solution: '**\My.sln'
    vsVersion: '15.0'
    restoreNugetPackages: true

- task: VSTest@2 # NOT DONE YET
  inputs:
    platform: '$(buildPlatform)'

And I realize now that restoreNugetPackages is deprecated. But when I build I get the error NETSDK1004 project.assets.json not found which is related to not using restore.

When I select the predefined option for restore, I'm curious what feed should I be selecting from Azure Artifacts or should I be selecting my nuget.config. How would I build a nuget.config? I don't have one currently in the repo.

Below are my current NuGet packages for the sln if this helps

Microsoft.Bcl.AsyncInterfaces
NETStandard.Library
Newtonsoft.Json
System.Runtime.CompilerServices.uNSafe
System.Threading.Tasks.Extensions
1
  • Have you checked my reply? Is it helpful? Commented Dec 28, 2020 at 9:18

2 Answers 2

1

Add NuGet task to restore nuget packages before running the build:

- task: NuGetCommand@2
  inputs:
    restoreSolution: '$(solution)'
- task: VSBuild@1
Sign up to request clarification or add additional context in comments.

Comments

0

As similar pattern of Cace's answer, the below code resolved the problem in my environment.

azure-pipelines.yml:

- task: NuGetCommand@2
  inputs:
    command: 'restore'
    restoreSolution: '**/*.sln'

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.