PSResourceGet: New-NugetPackage fails on german dotnet core (win)

Steps to reproduce

Publishing a module to my private PSRepositoy (Nexus3) fails. I’m not sure, but I guess it is broken since I have upgraded PScore from 6.1 to 6.2

Publish-Module -Path ".\dest\$ModuleName\$version\" -Repository $MyPrivateRepo -NuGetApiKey $NuGetApiKey -Credential $Credential

Actual behavior

Publish-PSArtifactUtility : Failed to generate the compressed file for module 'Cannot index into a null array.'.
At C:\program files\powershell\6\Modules\PowerShellGet\PSModule.psm1:10785 char:17
+ ...             Publish-PSArtifactUtility @PublishPSArtifactUtility_Param ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : InvalidOperation: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : FailedToCreateCompressedModule,Publish-PSArtifactUtility

I debugged the process and found the problem in the New-NugetPackage function https://github.com/PowerShell/PowerShellGet/blob/7de99ee0c38611556e5c583ffaca98bb1922a0d4/src/PowerShellGet/private/functions/New-NugetPackage.ps1#L119

dotnet.exe returns and localized string, so the -match does not work. For the positive match in german the expression should be something like:

'Das Paket "(.*.nupkg)" wurde erfolgreich erstellt.' 

For testing I have changed the expression and the package creation gets recognized correctly.

Environment data

I’am on german Windows 10 1903

> $PSVersionTable
Name                           Value
----                           -----
PSVersion                      6.2.1
PSEdition                      Core
GitCommitId                    6.2.1
OS                             Microsoft Windows 10.0.18362
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0
> Get-Module -ListAvailable PowerShellGet,PackageManagement
    Directory: C:\program files\powershell\6\Modules

ModuleType Version    Name                                PSEdition ExportedCommands
---------- -------    ----                                --------- ----------------
Script     1.3.2      PackageManagement                   Desk      {Find-Package, Get-Package, Get-PackageProvider, Get-PackageSource…}
Script     2.1.3      PowerShellGet                       Desk      {Find-Command, Find-DSCResource, Find-Module, Find-RoleCapability…}
> Get-PackageProvider -ListAvailable
Name                     Version          DynamicOptions
----                     -------          --------------
NuGet                    3.0.0.1          Destination, ExcludeVersion, Scope, SkipDependencies, Headers, FilterOnTag, Contains, AllowPrereleaseVersions, ConfigFile, SkipValidate
PowerShellGet            2.1.3.0          PackageManagementProvider, Type, Scope, AllowClobber, SkipPublisherCheck, InstallUpdate, NoPathUpdate, AllowPrereleaseVersions, Filter, Tag, Includes, DscResource, RoleCapability, Command, Acce…

It looks like there is another issue when publishing it to the repo (Publish-NugetPackage). The package gets pushed correctly but an error is returned.

...
info : Ihr Paket wurde per Push übertragen.

Failed to publish module 'mymodule': 'nuget.exe failed to push Im nicht interaktiven Modus kann keine Eingabeaufforderung erfolgen.
'.
At C:\program files\powershell\6\Modules\PowerShellGet\PSModule.psm1:10784 char:17
+ ...             Publish-PSArtifactUtility @PublishPSArtifactUtility_Param ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : FailedToPublishTheModule,Publish-PSArtifactUtility

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 2
  • Comments: 24 (4 by maintainers)

Commits related to this issue

Most upvoted comments

@KUTlime free to open up issues in the current repository (or upvote an existing issue) if there’s any you’ve encountered.

I’ve already did. 😉

Generally, I must conclude that the current code has low quality. If you open the solution, R# give you several hundreds of warnings or code improvements. “Messy” is the word which pop up in my mind when I was checking it.

I understand that it an early stage of development but even then I would pay more attention code quality and consistency. #IMHO

@alerickson Are you sure that this issue still remains in PowerShellGet v3?

@Stephanevg doesn’t mention which version he tried to use. It was probably v2.2.3. Since you have rewritten the module into C#, I wouldn’t be surprised that the issue is “solved” by this. There is not even New-NugetPackage cmdlet in PowerShellGet v3. 🤷‍♀️

@paule96 This could be one solution but it is just covering the true problem that is a poor design of generated package search.

Sadly, even after 7 weeks, this no solution is provided in the main repository. I had to publish module updates via hacked version of this module. 😦