Azure pipeline YAML – install project nuget packages

I have a solution containing roughly 100 aps.net 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:

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

I get the following error:

##[error]srcFeatureNykredit.Feature.SeleniumNykredit.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 http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is ......packagesMSTest.TestAdapter.1.2.0buildnet45MSTest.TestAdapter.props.

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

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 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.


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

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x