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
Description
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:
- Program Files
- User's App Data local path
- 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 )
Recommended fix:
elseif( (Microsoft.PowerShell.Management\Test-Path -Path $applocalDataExePath) -and ($applocalDataExePath | Microsoft.PowerShell.Core\Get-Command).Version -ge $script:NuGetExeMinRequiredVersion )