Skip to content

New-NugetPackage fails on german dotnet core (win) #149

@jmarkert

Description

@jmarkert

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions