Azure pipeline YAML – install project nuget packages

I have a solution containing roughly 100 projects, one of which is a Selenium test suite. I wish to create an Azure pipeline that installs only the Nuget packages of the Selenium project, and then builds and runs the Selenium tests. When running the VSBUILD step, my pipeline fails, claiming that the project NuGet packages are missing, so seemingly I’m not getting the project packages correctly. I have the following YAML:

    - master
      - cron: "0 22 * * *"
        displayName: Daily midnight run
          - feature/*
          - release/*
        always: true
      vmImage: 'windows-latest'
      solution: '**/*.sln'
      buildPlatform: 'Any CPU'
      buildConfiguration: 'Release'
    - task: [email protected]
    - task: [email protected]
      displayName: dotnet restore
        command: restore
        projects: '**/**/Nykredit.Feature.Selenium/Nykredit.Feature.Selenium.Test.csproj'
        includeNuGetOrg: true
    - task: [email protected]
      displayName: 'Build Selenium Tests'
        solution: '**/**/Nykredit.Feature.Selenium/Nykredit.Feature.Selenium.Test.csproj'
        vsVersion: 16.0
        # platform: '$(BuildPlatform)'
        # configuration: '$(BuildConfiguration)'
    - task: [email protected]
        command: test
        projects: '**/*/*.csproj'
        arguments: '--configuration $(buildConfiguration) --collect "Code coverage"'
    - task: [email protected]
        platform: '$(buildPlatform)'
        configuration: '$(buildConfiguration)'

I get the following error:

##[error]src\Feature\Nykredit.Feature.Selenium\Nykredit.Feature.Selenium.Test.csproj(73,5): Error : This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them.  For more information, see The missing file is ..\..\..\packages\MSTest.TestAdapter.1.2.0\build\net45\MSTest.TestAdapter.props.

Any suggestions as to how to install the packages of Nykredit.Feature.Selenium.Test.csproj only?

Here is Solutions:

We have many solutions to this problem, But we recommend you to use the first solution because it is tested & true solution that will 100% work for you.

Solution 1

While to cause of the error eludes me, the solution ended up being uninstalling and reinstalling the offending package. Presumably, this corrected some differences in versions in the configurations.

Note: Use and implement solution 1 because this method fully tested our system.
Thank you 🙂

All methods was sourced from or, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply