【问题标题】:Adding a NuGet Package Source that requires credentials with VS2015添加需要 VS2015 凭据的 NuGet 包源
【发布时间】:2016-04-16 20:57:43
【问题描述】:

我正在尝试设置需要凭据的 NuGet 包源。

Here are the instructions

我有最新版本的 Visual Studio 2015,一切都是最新的。我知道如何在 VS2015 中通过 UI 添加包源,但这样做时不能指定凭据。

他们要求我运行的命令是:

NuGet Sources Add -Name "telerik.com" -Source "https://nuget.telerik.com/nuget" -UserName "<your login email>" -Password "<your password>"

我知道我需要一个 nuget.exe 来运行此命令,但是有一种方法可以直接通过 VS 执行此操作而无需下载任何东西是不是?

如果我下载 NuGet.exe,打开命令提示符并导航到它以运行该命令,我是否能够从 Visual Studio 的 NuGet 包管理器 UI 中看到它并从 Visual Studio 的 NuGet 包管理器控制台访问它?我对它如何与 Visual Studio 的内置 NuGet 包管理器集成感到困惑。

【问题讨论】:

    标签: visual-studio visual-studio-2015 telerik nuget nuget-package


    【解决方案1】:

    我发现您需要将 nuget.exe 下载到您的计算机,打开命令提示符并导航到它。然后运行命令添加带有凭据的包源:

    NuGet Sources Add -Name "telerik.com" -Source "https://nuget.telerik.com/nuget" -UserName "<your login email>" -Password "<your password>"
    

    重新启动 Visual Studio,包源将添加到 Nuget UI 和 Nuget 命令行的列表中。

    【讨论】:

    • 仅供参考,这是通过将源信息存储在 %AppData%/Nuget/nuget.config 中来实现的
    【解决方案2】:

    如果您正在使用 SSO 并且 Windows 凭据修复对您不起作用,只需退出 Visual Studio,然后重新登录,然后重新启动 Visual Studio;然后,将修复 401 NuGet 包源错误。

    【讨论】:

      【解决方案3】:
      We can update the file Nuget.config file entry as  
      
      <add key="Telerik" value="https://nuget.telerik.com/nuget" 
      UserName ="<<youremail@mail.com>>" 
      Password ="<<password>>" />  
      
      This let me build and run.
      

      【讨论】:

        【解决方案4】:

        我尝试了他的回答中描述的方法Blake Rivell。它对我不起作用,所以我尝试使用-StorePasswordInClearText 标志。 (请参阅问题中提到的说明)

        然后我发现我开始从事的项目包含一个“NuGet.Config”文件。此文件中源的显示名称与我通过命令行添加的显示名称不同(全局“NuGet.Config”文件)。 (我们不同的项目显然使用不同的名称)

        所以它不起作用,因为它无法将源与凭据与我本地“NuGet.Config”文件中的条目相关联。

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2021-03-04
          • 2017-02-13
          相关资源
          最近更新 更多