Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何在运行dotnet restore时使用私有nuget包源进行身份验证_C#_.net_Nuget - Fatal编程技术网

C# 如何在运行dotnet restore时使用私有nuget包源进行身份验证

C# 如何在运行dotnet restore时使用私有nuget包源进行身份验证,c#,.net,nuget,C#,.net,Nuget,我正试图在命令行上运行dotnet restore--configfile NuGet.config my solution.sln,以从私有NuGet源还原包,但我无法使用私有NuGet进行身份验证,因此出现以下错误: Retrying 'FindPackagesByIdAsyncCore' for source 'http://my.private.nuget/source/FindPackagesById()?semVerLevel=2.0.0'. Response status code

我正试图在命令行上运行
dotnet restore--configfile NuGet.config my solution.sln
,以从私有NuGet源还原包,但我无法使用私有NuGet进行身份验证,因此出现以下错误:

Retrying 'FindPackagesByIdAsyncCore' for source 'http://my.private.nuget/source/FindPackagesById()?semVerLevel=2.0.0'.
Response status code does not indicate success: 401 (Unauthorized).
但是,我能够成功地从
visual studio
还原程序包,当我尝试从
visual studio
还原nuget程序包时,我收到一条提示,要求提供凭据,添加凭据后,还原操作正确


当我通过命令行还原时,我试图找出需要在何处添加私有nuget的凭据。

我通过在
nuget.config
文件中添加nuget凭据解决了这个问题,请参阅此
要了解如何正确设置
Nuget.config
文件的格式,如
Nuget 4.6
及以下版本,向
Nuget.config
添加凭据的格式与新版本不同。

您是否尝试过传递
--interactive
?否,你能给我举一个例子说明我是如何通过的吗?与dotnet restore@kit一起交互这能回答你的问题吗?在您的情况下,它将是
dotnet restore--configfile NuGet.config my solution.sln
,但我建议您看看其他评论者发布的问题。--interactive没有帮助。我已经回答了我自己的问题,关于我如何在不安装任何东西的情况下解决它