Skip to content
This repository was archived by the owner on Jun 13, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion PowerShellGet/PSGet.Resource.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ ConvertFrom-StringData @'
ModuleVersionShouldBeGreaterThanGalleryVersion=Module '{0}' with version '{1}' cannot be published. The version must exceed the current version '{2}' that exists in the repository '{3}', or you must specify -Force.
ModuleVersionIsAlreadyAvailableInTheGallery=The module '{0}' with version '{1}' cannot be published as the current version '{2}' is already available in the repository '{3}'.
CouldNotInstallNuGetProvider=NuGet provider is required to interact with NuGet-based repositories. Please ensure that '{0}' or newer version of NuGet provider is installed.
CouldNotInstallNuGetExe=NuGet.exe or dotnet command version '{0}' or newer is required to interact with NuGet-based repositories. Please ensure that NuGet.exe or dotnet command is available under one of the paths specified in PATH environment variable value.
CouldNotInstallNuGetExe=NuGet.exe version '{0}' or newer, or dotnet command version '{1}' or newer is required to interact with NuGet-based repositories. Please ensure that NuGet.exe or dotnet command is available under one of the paths specified in PATH environment variable value.
CouldNotUpgradeNuGetExe=NuGet.exe version '{0}' or newer, or dotnet command version '{1}' or newer is required to interact with NuGet-based repositories. Please ensure that required version of NuGet.exe or dotnet command is available under one of the paths specified in PATH environment variable value.
CouldNotFindDotnetCommand=For publish operations, dotnet command version '{0}' or newer is required to interact with the NuGet-based repositories. Please ensure that dotnet command version '{0}' or newer is installed and available under one of the paths specified in PATH environment variable value. You can also install the dotnet command by following the instructions specified at '{1}'.
CouldNotInstallNuGetBinaries2=PowerShellGet requires NuGet.exe (or dotnet command) and NuGet provider version '{0}' or newer to interact with the NuGet-based repositories. Please ensure that '{0}' or newer version of NuGet provider is installed and NuGet.exe (or dotnet command) is available under one of the paths specified in PATH environment variable value.
InstallNugetBinariesUpgradeShouldContinueQuery=This version of PowerShellGet requires minimum version '{0}' of NuGet.exe and minimum version '{1}' of NuGet provider to publish an item to NuGet-based repositories. The NuGet provider must be available in '{2}' or '{3}'. You can also install the NuGet provider by running 'Install-PackageProvider -Name NuGet -MinimumVersion {0} -Force'. NuGet.exe must be available in '{4}' or '{5}', or under one of the paths specified in PATH environment variable value. NuGet.exe can be downloaded from https://aka.ms/psget-nugetexe. For more information, see https://go.microsoft.com/fwlink/?linkid=875534. Do you want PowerShellGet to upgrade NuGet.exe to the latest version and install the NuGet provider now?
Expand Down
22 changes: 16 additions & 6 deletions PowerShellGet/private/functions/Install-NuGetClientBinaries.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,7 @@ function Install-NuGetClientBinaries
$failedToBootstrapNuGetProvider = $false
$failedToBootstrapNuGetExe = $false


if($bootstrapNuGetProvider -and -not $script:NuGetProvider)
{
$failedToBootstrapNuGetProvider = $true
Expand All @@ -308,14 +309,23 @@ function Install-NuGetClientBinaries
$errorId = 'CouldNotInstallNuGetProvider'
}

if($BootstrapNuGetExe -and
(-not $script:NuGetExePath -or
-not (Microsoft.PowerShell.Management\Test-Path -Path $script:NuGetExePath)))
if($BootstrapNuGetExe)
{
$failedToBootstrapNuGetExe = $true
if(-not $script:NuGetExePath -or
-not (Microsoft.PowerShell.Management\Test-Path -Path $script:NuGetExePath))
{
$failedToBootstrapNuGetExe = $true

$message = $LocalizedData.CouldNotInstallNuGetExe -f @($script:NuGetExeMinRequiredVersion, $script:MinimumDotnetCommandVersion)
$errorId = 'CouldNotInstallNuGetExe'
}
elseif($script:NuGetExeVersion -and ($script:NuGetExeVersion -lt $script:NuGetExeMinRequiredVersion))
{
$failedToBootstrapNuGetExe = $true

$message = $LocalizedData.CouldNotInstallNuGetExe -f @($script:MinimumDotnetCommandVersion)
$errorId = 'CouldNotInstallNuGetExe'
$message = $LocalizedData.CouldNotUpgradeNuGetExe -f @($script:NuGetExeMinRequiredVersion, $script:MinimumDotnetCommandVersion)
$errorId = 'CouldNotUpgradeNuGetExe'
}
}

# Change the error id and message if both NuGet provider and NuGet.exe are not installed.
Expand Down