-
Notifications
You must be signed in to change notification settings - Fork 100
Description
Steps to reproduce
I release dbachecks using Azure DevOps and the following code
# Get the Module versions
Install-Module Configuration -RequiredVersion 1.3.0 -Scope CurrentUser -Force -Confirm:$false
$Modules = Get-ManifestValue -Path "$(System.DefaultWorkingDirectory)/Master - Version Update, Signing and Publish Artifact/dbachecks\dbachecks.psd1" -PropertyName RequiredModules
$PesterVersion = $Modules.Where{$_.Get_Item('ModuleName') -eq 'Pester'}[0].Get_Item('ModuleVersion')
$PSFrameworkVersion = $Modules.Where{$_.Get_Item('ModuleName') -eq 'PSFramework'}[0].Get_Item('ModuleVersion')
$dbatoolsVersion = $Modules.Where{$_.Get_Item('ModuleName') -eq 'dbatools'}[0].Get_Item('ModuleVersion')
# Install Required Modules
Install-Module dbatools -RequiredVersion $dbatoolsVersion -Scope CurrentUser -Force -Confirm:$false
Install-Module Pester -RequiredVersion $PesterVersion -Scope CurrentUser -SkipPublisherCheck -Force -Confirm:$false
Install-Module PSFramework -RequiredVersion $PsFrameworkVersion -Scope CurrentUser -Force -Confirm:$false
try{
#Publish Module
Publish-Module -Path "$(System.DefaultWorkingDirectory)/Master - Version Update, Signing and Publish Artifact/dbachecks" -NuGetApiKey "$(GalleryApiKey)" -ErrorAction Stop -Confirm:$false
}
Catch{
$Error | fl -force
Throw
}
Expected behavior
The module publishes
Actual behavior
As you can see here
https://dev.azure.com/sqlcollaborative/dbachecks/_releaseProgress?_a=release-environment-logs&releaseId=113&environmentId=113
The module does not publish and the error is
--------------------------------------------------------------------------------------
Microsoft (R) Build Engine version 16.3.0+0f4c62fea for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.
Restore completed in 4.51 sec for
C:\Users\VssAdministrator\AppData\Local\Temp\9dad64e4-41a8-4c9b-882d-aae5b111dc80\Temp.csproj.
Temp ->
C:\Users\VssAdministrator\AppData\Local\Temp\9dad64e4-41a8-4c9b-882d-aae5b111dc80\bin\Debug\netcoreapp2.0\NotUsed.dll
C:\Program Files\dotnet\sdk\3.0.100\Sdks\NuGet.Build.Tasks.Pack\build\NuGet.Build.Tasks.Pack.targets(198,5): warning
NU5119: File 'C:\Users\VssAdministrator\AppData\Local\Temp\2135169501\dbachecks\.gitattributes' was not added to the
package. Files and folders starting with '.' or ending with '.nupkg' are excluded by default. To include this file,
use -NoDefaultExcludes from the commandline
[C:\Users\VssAdministrator\AppData\Local\Temp\9dad64e4-41a8-4c9b-882d-aae5b111dc80\Temp.csproj]
C:\Program Files\dotnet\sdk\3.0.100\Sdks\NuGet.Build.Tasks.Pack\build\NuGet.Build.Tasks.Pack.targets(198,5): warning
NU5119: File 'C:\Users\VssAdministrator\AppData\Local\Temp\2135169501\dbachecks\.gitignore' was not added to the
package. Files and folders starting with '.' or ending with '.nupkg' are excluded by default. To include this file,
use -NoDefaultExcludes from the commandline
[C:\Users\VssAdministrator\AppData\Local\Temp\9dad64e4-41a8-4c9b-882d-aae5b111dc80\Temp.csproj]
Successfully created package
'C:\Users\VssAdministrator\AppData\Local\Temp\2135169501\dbachecks\dbachecks.1.2.16.nupkg'.
C:\Program Files\dotnet\sdk\3.0.100\Sdks\NuGet.Build.Tasks.Pack\build\NuGet.Build.Tasks.Pack.targets(198,5): error :
Index was outside the bounds of the array.
[C:\Users\VssAdministrator\AppData\Local\Temp\9dad64e4-41a8-4c9b-882d-aae5b111dc80\Temp.csproj]
'.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\2.2.1\PSModule.psm1:10944 char:17
+ ... Publish-PSArtifactUtility @PublishPSArtifactUtility_Param ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : FailedToCreateCompressedModule,Publish-PSArtifactUtility
Environment data
I could also replicate this with the latest PowerShellGet on pwsh 6.2.3 and 5.1 on my laptop
I was successfully able to publish the module from a different machine running 5.1 using
PS5> Get-Module powershellget -ListAvailable
Directory: C:\Program Files\WindowsPowerShell\Modules
ModuleType Version Name ExportedCommands
Script 2.0.3 PowerShellGet {Find-Command, Find-DSCResource, Find-Module, Find-RoleCapability...}
Could this be related to PowerShell/PowerShellGetv2#551 dbachecks has required modules also?