Nuget

O Nuget é a plataforma para gestão de pacotes no .NET SDK e utilizado para a instalação do Devprime CLI.

Um erro comum ao tentar instalar o Devprime CLI é não ter a configuração padrão do nuget público em sua lista de sources. Antes de avançar confirme se possue a versão mais atualizada do .NET SDK (Windows, Linux, Mac).
dotnet --version

error NU1101: Unable to find package Devprime.cli. No packages exist with this id in source(s): C:\Program Files\dotnet\sdk\NuGetFallbackFolder, Microsoft Visual Studio Offline Packages
Tool 'Devprime.cli' failed to update due to the following:
The tool package could not be restored.
Tool 'Devprime.cli' failed to install. This failure may have been caused by:

* You are attempting to install a preview release and did not use the --version option to specify the version.
* A package by this name was found, but it was not a .NET tool.
* The required NuGet feed cannot be accessed, perhaps because of an Internet connection problem.
* You mistyped the name of the tool.

For more reasons, including package naming enforcement, visit https://aka.ms/failure-installing-tool
  1. Forçar a instalação indicando o nuget
    dotnet tool update -g --add-source 'https://api.nuget.org/v3/index.json' --ignore-failed-sources Devprime.cli

  2. Limpar o cache nuget local
    dotnet nuget locals all --clear

  3. Verificar e corrigir os sources no Nuget local.
    dotnet nuget list source

O resultado deve ser algo parecido com o exemplo abaixo indicando o Source do Nuget como ‘Enabled’.

Registered Sources:
  1.  nuget.org [Enabled]
      https://api.nuget.org/v3/index.json
  2.  Microsoft Visual Studio Offline Packages [Enabled]
      C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\

Para remover um source basta informar o seu nome
dotnet nuget remove source nuget.org

Para adicionar a fonte do nuget público
dotnet nuget add source https://api.nuget.org/v3/index.json -n nuget.org

NOTA: A existiência de url privadas com falhas podem resultar em erros ao utilizar o serviço de nuget.

Para saber mais:

Última modificação August 25, 2023 (aef3397d)