'Installing dotnet new template not working from NuGet Feed, works locally

Looking for some guidance on fault finding an install from dotnet new -i <NUGET_PACKAGE_ID>

I have a template which is packaged and deployed to an Azure Devops NuGet Feed. I can't install this template when I use the dotnet new -i <NUGET_PACKAGE_ID> However I'm able to install it if I download .nupkg file from nuget server and install it from the file system.

I get no diagnostics messages from the install process. Is there a way of seeing detailed messaging on what is wrong with this template. I'm suspecting it's an auth problem or similar.



Solution 1:[1]

Is there a way of seeing detailed messaging on what is wrong with this template.

You can add add the DOTNET_CLI_CONTEXT_VERBOSE environment variable with value true to get more verbose logging.

Then you will get the actual error, which is most likely an authorization issue:

Response status code does not indicate success: 401 (Unauthorized).

In that case you need to install the Azure Artifacts Credential Provider and run the install command interactively once again:

dotnet new -i <NUGET_PACKAGE_ID> --interactive

Then you will get instructions on how to authenticate with the Azure Devops NuGet feed.
See Unable to install template from Azure DevOps Nuget Feed issue for more details.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Kapé