1

我已经升级到 dotnet sdk 3.1 版并正在尝试发布我的 powershell 模块。我正在使用 powershell 5.1。

我运行命令:

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

并得到错误:

[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

有没有人有类似的问题并设法解决它?谢谢

4

1 回答 1

0

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?

于 2020-04-30T08:05:10.130 回答