Skip to content
This repository was archived by the owner on Jun 13, 2024. It is now read-only.
This repository was archived by the owner on Jun 13, 2024. It is now read-only.

Publish-Module fails to publish when large number of functions are exported #344

Closed
@Texernie

Description

@Texernie

Publish-Module creates an invalid nuspec file when a large number of functions are exported in a powershell module. The problem is that down in Publish-PSArtifactUtility, it brute forces all of the exported function names into the tags. My particular case resulted in a tag field around 11000 characters, way over the 4000 limit. I am publishing to a self-hosted nuget gallery, but it is based upon the current production branch.

It would be nice if it either truncated the values at 4000 characters with a warning, or allow a total override of the tags.

Steps to reproduce

Create a module with many functions to export. Mine has 116 distinct functions.
$functionNames = (Get-ChildItem '.\MyModule\Scripts' *.ps1).BaseName
Update-ModuleManifest `
    -Path '.\MyModule\MyModule.psd1' `
    -FunctionsToExport $functionNames 

Publish-Module -Path (resolve-path .\MyModule)  | Out-Null

Expected behavior

Publishing of the module to succeed and a nuget package exist in the repository.

Actual behavior

Publish-PSArtifactUtility : Failed to publish module 'MyModule': 'Response status code does not indicate success: 400 (A nuget package's Tags
property may not be more than 4000 characters long.).
'.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\2.0.1\PSModule.psm1:10859 char:17
+ ...             Publish-PSArtifactUtility @PublishPSArtifactUtility_Param ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : FailedToPublishTheModule,Publish-PSArtifactUtility

Environment data

> $PSVersionTable
Name                           Value
----                           -----
PSVersion                      5.1.17134.228
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.17134.228
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
> Get-Module -ListAvailable PowerShellGet,PackageManagement

    Directory: C:\Program Files\WindowsPowerShell\Modules


ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Script     1.1.7.2    PackageManagement                   {Find-Package, Get-Package, Get-PackageProvider, Get-PackageSource...}
Binary     1.0.0.1    PackageManagement                   {Find-Package, Get-Package, Get-PackageProvider, Get-PackageSource...}
Binary     1.0.0.0    PackageManagement                   {Find-Package, Get-Package, Get-PackageProvider, Get-PackageSource...}
Script     2.0.1      PowerShellGet                       {Find-Command, Find-DSCResource, Find-Module, Find-RoleCapability...}
Script     1.0.0.1    PowerShellGet                       {Install-Module, Find-Module, Save-Module, Update-Module...}
> Get-PackageProvider -ListAvailable

Name                     Version          DynamicOptions
----                     -------          --------------
DockerProvider           0.0.0.3          Update
msi                      3.0.0.0          AdditionalArguments
msu                      3.0.0.0
nuget                    2.8.5.208
NuGet                    2.8.5.210        Destination, ExcludeVersion, Scope, SkipDependencies, Headers, FilterOnTag...
PowerShellGet            1.0.0.1          PackageManagementProvider, Type, Scope, AllowClobber, SkipPublisherCheck, ...
Programs                 3.0.0.0          IncludeWindowsInstaller, IncludeSystemComponent
PS> get-command publish-module

CommandType     Name                                               Version    Source
-----------     ----                                               -------    ------
Function        Publish-Module                                     2.0.1      PowerShellGet

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