For dotnet new -i. To use install a template behind private nuget feed the user cannot specify nuget feed in the command line . The user need to set the nuget feed in the global nuget config.
After adding a private nuget feed, if the feed need auth. The user will see the following error
/Users/williamli/Documents/cli/artifacts/tmp/Debug/dotnet/sdk/3.0.100-preview-009752/NuGet.targets(114,5): warning : The plugin credential provider could not acquire credentials. Authentication may require manual action. Consider re-running the command with --interactive for `dotnet`, /p:NuGetInteractive="true" for MSBuild or removing the -NonInteractive switch for `NuGet` [/Users/williamli/.templateengine/dotnetcli/v3.0.100-preview-009752/scratch/restore.csproj]
However, --interactive command is not available for dotnet new
To repro add my private feed to ~/.nuget/NuGet/NuGet.Config
<add key="testingnugetauth" value="https://williamleewul.pkgs.visualstudio.com/_packaging/testingnugetauth/nuget/v3/index.json" />
And run dotnet new -i wul.DotNet.Common.ItemTemplates
--interactive is passed to subsequence restore.related to https://github.com/dotnet/templating/issues/1545 but now we have --interactive
@wli3 if no auth is needed, the --nuget-source allows you to specify an alternate feed to use
@mlorbetske your answer clears up #1.
For #2 and 3, we've done work in the CLI to improve the authentication experience for NuGet private feeds. We'd like to see this added to dotnet new as well. The interactive switch is needed both to access the feed with the template (#2) and the restore if it uses any packages that come from a different feed and that feed needs authentication #3
@KathleenDollard understood, I was only commenting with regard to the first item. We'll schedule the work to pass the --interactive switch in the internal calls to restore
Is there any documentation on this new --interactive flag or can anyone clear up for me if this will help with #1545 ?
Any update on this issue?
No update at this point.
Any update on this issue?
Any update? This prevents using custom templates in DevOps artifacts feeds.
@anderly meanwhile you could run any other command that supports --interactive first to the authorized
@wli3 which command can I run that supports --interactive if I'm running in a directory that has no sln or project?
@nkolev92 I remember there is a command just to get authorized
Unfortunately we don't have any commands that will just authorize.
You have add something like restore/add package that absolutely requires a remote feed.
@nkolev92 @wli3 ok. gonna try to publish the templates package to a file-shared based nuget source instead until this is supported.
@grinrag greetings. Based on recent traffic we should move up the priority list. Please bring it up in the next triage.
I don't know if this will help anyone, but I ended up on this page after searching for a way to install dotnet new templates from a nuget package in a feed that requires user credentials. I found the way to do that without requiring an --interactive switch. First add the nuget source with your credentials
nuget source Add -Name "<name>" -Source "<your nuget source>" -UserName <your username> -Password <your password> And then templates can be installed from that source dotnet new -i <your template package name> --nuget-source <your nuget source>
If this is not what everyone else is trying to do, sorry for the misunderstanding.
@npuc85 was this for on-prem or cloud devops? I can't seem to get it to work with cloud devops.
Something like that works for us:
ps
.\installcredprovider.ps1 -AddNetfx
Run the following command:
CredentialProvider.Microsoft.exe -U <your nuget source>
Run the following command to install the template to your dotnet cli templates:
dotnet new -i <template name> --nuget-source <your nuget source>
Hope this will help :)
@Boruc04 thanks for the steps! That works!
@Boruc04 thanks for this, we were having trouble with this via our Azure DevOps feed.
I don't know if this will help anyone, but I ended up on this page after searching for a way to install dotnet new templates from a nuget package in a feed that requires user credentials. I found the way to do that without requiring an
--interactiveswitch. First add the nuget source with your credentials
nuget source Add -Name "<name>" -Source "<your nuget source>" -UserName <your username> -Password <your password>And then templates can be installed from that sourcedotnet new -i <your template package name> --nuget-source <your nuget source>If this is not what everyone else is trying to do, sorry for the misunderstanding.
Thanks, I created a PAT and this worked for me. I hope this --interactive option will be available soon, so we don't have to create PATs
This was delivered in .NET 5.0 with #2276.
Most helpful comment
Any update on this issue?