Skip to content
This repository was archived by the owner on Jun 13, 2024. It is now read-only.
This repository was archived by the owner on Jun 13, 2024. It is now read-only.

Issues when older nuget.exe installed in Program Files #556

Closed
@bwright86

Description

@bwright86

Issue Description:

Publish-Module favors any nuget.exe file found in Program Files, even if it doesn't meet the minimum version requirement.

I am experiencing this, as a non-admin user on my desktop, an older version of nuget.exe is installed in Program Files. But if I download a newer version from Microsoft and place it in my AppData Local path, the logic does not allow it to be discovered, but instead prompts me to install nuget.exe in one of the following locations:

  1. Program Files
  2. User's App Data local path
  3. A location available from $env:PATH

Here is the location that this is happening:
https://github.com/PowerShell/PowerShellGet/blob/712d6d3b64980bba1a46f20e5e843aef8319de53/src/PowerShellGet/private/functions/Install-NuGetClientBinaries.ps1#L96

Recommended fix:

if( (Microsoft.PowerShell.Management\Test-Path -Path $programDataExePath) -and ($programDataExePath | Microsoft.PowerShell.Core\Get-Command).Version -ge $script:NuGetExeMinRequiredVersion )

https://github.com/PowerShell/PowerShellGet/blob/712d6d3b64980bba1a46f20e5e843aef8319de53/src/PowerShellGet/private/functions/Install-NuGetClientBinaries.ps1#L100

Recommended fix:

elseif( (Microsoft.PowerShell.Management\Test-Path -Path $applocalDataExePath) -and ($applocalDataExePath | Microsoft.PowerShell.Core\Get-Command).Version -ge $script:NuGetExeMinRequiredVersion )

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions