PowerShell / PowerShellGallery

236 stars 66 forks source link

Unable to publish a module #251

Closed Const-me closed 1 year ago

Const-me commented 1 year ago

Prerequisites

Steps to reproduce

Unable to publish package Binaries https://github.com/Const-me/Whisper/releases/download/1.10.0/WhisperPS.zip Source code https://github.com/Const-me/Whisper/tree/master/WhisperPS

Publish command: Publish-Module -Name WhisperPS -NugetAPIKey "<redacted>" -Verbose

Expected behavior

Should publish

Actual behavior

Refuses to publish.

Prints following verbose message:

Cannot verify the Microsoft .NET Framework version 4.7.2 because it is not included in the list of permitted versions.

Q1. Where can I find the list of the permitted versions mentioned in that message?

I’m not sure how relevant that is, because the actual error message says something different.

Publish-PSArtifactUtility : Failed to publish module 'WhisperPS': 'The underlying connection was closed: An unexpected error occurred on a send.
'.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:1227 char:17
+                 Publish-PSArtifactUtility -PSModuleInfo $moduleInfo `
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : FailedToPublishTheModule,Publish-PSArtifactUtility

Q2. Is that related to the runtime version message? And if no, how to fix the error?

P.S. I do not want “latest versions” because useless for my use case. 99% of users have very specific PS version, the version which is shipped with the operating system. That's the only PS version I target.

Error details

Get-Error : The term 'Get-Error' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try
again.
At line:1 char:1
+ Get-Error
+ ~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Get-Error:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

Environment data

Name                           Value
----                           -----
PSVersion                      5.1.19041.2673
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.19041.2673
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Version

5.1.19041.2673

Visuals

No response

SydneyhSmith commented 1 year ago

@Const-me thanks for opening an issue! can you try upgrading your version of PowerShellGet to 2.2.5 (latest)? And then let us know if you are still seeing this issue, thanks! https://www.powershellgallery.com/packages/PowerShellGet/2.2.5

Const-me commented 1 year ago

@SydneyhSmith Thanks, that helped.

For future users, maybe you could adjust the issue template?

When you wrote “you are able to repro it on the latest version” I assumed you meant “the latest version of the PowerShell runtime” which would be 7.3.2, and I have no interest in supporting until shipped with Windows.

Instead, you have meant “the latest version of the PowerShellGet module”, which is still supported on PS 5.1 included in Windows.