Quick update on PSGallery publishing

I’ve recently published an update to my Autoruns module on the PowerShell Gallery but I encountered some error messages.

The first one was:

Publish-PSArtifactUtility : Failed to publish module ‘AutoRuns’: ‘Failed to process request. ‘A client version ‘4.1.0’ or higher is required to be able to publish packages. Install the latest version of NuGet client or install the latest version of PowerShellGet module using the instructions provided at https://aka.ms/installing-powershellget. Please contact cgadmin@microsoft.com to get more details.’.
The remote server returned an error: (400) Bad Request..’.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:1227 char:17

As you can see I was still using the 1.0.0.1 version of the PowerShellGet module 😦
I updated the module to the 2.0.4 version using the instructions provided in the error message: https://aka.ms/installing-powershellget

Then I had 2nd error message:
NuGet.exe upgrade is required to continue
This version of PowerShellGet requires minimum version ‘4.1.0’ of NuGet.exe to publish an item to the NuGet-based repositories. NuGet.exe must be available in ‘C:\ProgramData\Microsoft\Windows\PowerShell\PowerShellGet\’ or ‘C:\Users\local-user\AppData\Local\Microsoft\Windows\PowerShell\PowerShellGet\’, 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://aka.ms/installing-powershellget .
Do you want PowerShellGet to upgrade to the latest version of NuGet.exe now?

It seems I missed the first lines about Nuget.exe in the instructions provided on https://aka.ms/installing-powershellget . My bad.
Notice that PowerShell message is very helpful. I had a nuget.exe in one of these paths but it was tool old. I downloaded a version 4.9.x in that same path and was able to publish the module successfully.

Where are the publishing requirements, again?

When were these new Nuget.exe and PowerShellGet module requirements introduced?

Well, it’s explained in the following blog post from the PowerShell Team on September 12th, 2018

Most important: Publishers must update to PowerShellGet module version 1.6.8 or higher to publish to the PowerShell Gallery. Older versions of PowerShellGet are fine for find, save, install, and update functions, but not for publishing.
[…]
The previous versions of PowerShell Gallery and PowerShellGet were based on older versions of NuGet. With this change we are aligning much more closely with the current state of the NuGet server and client. Many of the changes listed above – including the account and API key management – came directly from the NuGet updates. Another feature NuGet implemented is the ability to delete a package they have published accidentally, within the first hour after publishing.

The related documentation was also updated on September 12th, 2018

1 thought on “Quick update on PSGallery publishing

  1. Pingback: Dew Drop – March 4, 2019 (#2911) | Morning Dew

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.