简体   繁体   中英

Publish-Module fails with NuGet.Build.Tasks.Pack.targets(198,5) error : Index was outside the bounds of the array

I've upgraded to dotnet sdk version 3.1 and am trying to publish my powershell module. I am using powershell 5.1.

I run the command:

Publish-Module -Path "C:\sources\myModules\InstallationUtils\" -NuGetApiKey "xxxxxxx" -Repository internal.packages.org" 

and get the error:

[C:\Users\xxxxxx\AppData\Local\Temp\469d7c83-6e1a-4366-b948-6a415b0279be\Temp.csproj]
  Successfully created package
'C:\Users\xxxxxx\AppData\Local\Temp\158464074\myModules\InstallationUtils\InstallationUtils.1.4.8.nupkg'.
C:\Program Files\dotnet\sdk\3.1.201\Sdks\NuGet.Build.Tasks.Pack\build\NuGet.Build.Tasks.Pack.targets(198,5): error :
Index was outside the bounds of the array.
[C:\Users\xxxxxx\AppData\Local\Temp\469d7c83-6e1a-4366-b948-6a415b0279be\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

Is anyone have similar issues and managed to fix it? thanks

I have a work around, which involves replacing the old version of version nuget.exe in

C:\Users\xxxxx\AppData\Local\Microsoft\Windows\PowerShell\PowerShellGet\

with the latest version of nuget.exe.

I found the work around on SQLDBAWithABeard but I am hoping that there is a better solution than this?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM