Powershell-Publish-Modul schlägt fehl

Powershell-Publish-Modul schlägt fehl

Wenn ich versuche, ein Modul aus Powershell (7.1.3) zu veröffentlichen, erhalte ich diesen Fehler:

> Publish-Module -Name GreatDismal -NuGetApiKey [...]

Write-Error: C:\program files\powershell\7\Modules\PowerShellGet\PSModule.psm1:10990
 Line |
10990 |  …             Publish-PSArtifactUtility @PublishPSArtifactUtility_Param …
      |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      | Failed to generate the compressed file for module 'C:\Program Files\dotnet\dotnet.exe failed to pack: error Microsoft (R) Build Engine
      | version 16.9.0+57a23d249 for .NET Copyright (C) Microsoft Corporation. All rights reserved.    Determining projects to restore...
      | C:\Program Files\dotnet\sdk\5.0.202\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.EolTargetFrameworks.targets(28,5): warning
      | NETSDK1138: The target framework 'netcoreapp2.0' is out of support and will not receive security updates in the future. Please refer
      | to https://aka.ms/dotnet-core-support for more information about the support policy.
      | [C:\Users\sdixon\AppData\Local\Temp\49504ccb-87a6-43db-9133-46ffdc798eb9\Temp.csproj] C:\Program
      | Files\dotnet\sdk\5.0.202\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.EolTargetFrameworks.targets(28,5): warning NETSDK1138: The
      | target framework 'netcoreapp2.0' is out of support and will not receive security updates in the future. Please refer to
      | https://aka.ms/dotnet-core-support for more information about the support policy.
      | [C:\Users\sdixon\AppData\Local\Temp\49504ccb-87a6-43db-9133-46ffdc798eb9\Temp.csproj]
      | C:\Users\sdixon\AppData\Local\Temp\49504ccb-87a6-43db-9133-46ffdc798eb9\Temp.csproj : error NU1100: Unable to resolve
      | 'Microsoft.NETCore.App (>= 2.0.0)' for '.NETCoreApp,Version=v2.0'.   Failed to restore
      | C:\Users\sdixon\AppData\Local\Temp\49504ccb-87a6-43db-9133-46ffdc798eb9\Temp.csproj (in 94 ms).  '.

Ich habe versucht, dotnet-sdk und dotnetcore neu zu installieren, ohne Erfolg, und das war’s für mich. Irgendwelche Ideen?

Antwort1

Ich weiß nicht, warum das funktioniert hat, aber es scheint das Problem gelöst zu haben:

Set-PSRepository -Name PSGallery -InstallationPolicy Trusted
Install-PackageProvider -Name PowerShellGet -Force -Scope CurrentUser

Habe diese Lösung in einem Fehlerbericht für dieses Problem hier gefunden:https://github.com/PowerShell/PowerShellGetv2/issues/303

verwandte Informationen