Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

choco install error #50

Open
ashishchettri opened this issue Dec 11, 2019 · 1 comment
Open

choco install error #50

ashishchettri opened this issue Dec 11, 2019 · 1 comment

Comments

@ashishchettri
Copy link

Expected Behavior

I am trying to install a package but keep getting a "##[error]Cannot bind argument to parameter 'Path' because it is null". The yaml is as follows:

- task: ChocolateyCommand@0
  inputs:
    command: 'install'
    installPackageId: 'sonarscanner-msbuild-net46'
    installForce: true

What I expected was it to run the way choco install sonarscanner-msbuild-net46 --force works when installing the package directly using powershell.

Current Behavior

I get a "##[error]Cannot bind argument to parameter 'Path' because it is null".

Possible Solution

I went ahead and installed chocolatey using the default powershell commands -

- task: PowerShell@2
  inputs:
    targetType: 'inline'
    script: |      
      Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
      SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin" 
      $env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User") 

Steps to Reproduce (for bugs)

  1. Add the task
  2. Select action as 'Install'
  3. Choose any package to install. e.g. azure-cli
  4. Execute the pipeline

Context

We are using chocolatey to install a sonarscanner so that we can run static analysis.

Your Environment

  • Module version used:
  • Windows 10 and PowerShell version: 5.1
@gep13
Copy link
Member

gep13 commented Dec 12, 2019

@ashishchettri thanks for reaching out.

I am a little confused by this issue, and I want to make sure that we are talking about the same thing. You start the issue by saying that there is an error when attempting the installation of the sonarscanner package, and then you talk about installing Chocolatey via the default PowerShell command.

Assuming that you are using the Hosted Azure Build Agent, installing Chocolatey should not be required, as Chocolatey is already installed on the base image. If you are not running on a Hosted Azure Build Agent, then as per the note here: https://github.com/gep13/chocolatey-azuredevops#tasks you will need another Task to perform the installation of Chocolatey.

If you can elaborate on exactly the problem that you are having, hopefully we will be able to help you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants