【问题标题】:NuGet fails to find package if it's not in Cache如果包不在缓存中,NuGet 找不到包
【发布时间】:2016-12-23 02:31:52
【问题描述】:

我有一个用于 NuGet 的内部提要设置。当我尝试构建我的一个项目时(通过 TFS 构建服务器),我收到一个错误,即 NuGet 找不到包 yyy 的版本 xxx。

我转到服务器上的 NuGet 包文件夹,那里有正确的包/版本。但是,NuGet 缓存文件夹中不存在包/版本:

C:\Users[用户帐户]\AppData\Local\NuGet\Cache

如果我将正确的包/版本复制到此缓存文件夹,则构建成功。

有什么想法吗?

【问题讨论】:

    标签: visual-studio-2013 tfs nuget


    【解决方案1】:

    可能与 NuGet fails to find existing package 重复。如果存在与搜索和包还原功能相关的一些服务问题。这可能是您的包还原失败的原因。

    如果有此包的缓存版本,NuGet 将访问那里并且恢复将正常工作。

    解决方案是将您的 nugget 更新到最新版本(至少 3.4+)您也可以参考 GitHub 中的类似问题:Package restore intermittently fails with "Unable to find version 'x' of package 'y'"

    【讨论】:

      【解决方案2】:

      检查项目中的 Nuget.config。它应该具有源的路径,即服务器上的 NuGet 包文件夹应该存在于 nuget.config 文件中。

      <?xml version="1.0" encoding="utf-8"?>
      <configuration>
        <solution>
          <add key="disableSourceControlIntegration" value="true" />
        </solution>
        <packageRestore>
          <!-- Allow NuGet to download missing packages -->
          <add key="enabled" value="True" />
      
          <!-- Automatically check for missing packages during build in Visual Studio -->
          <add key="automatic" value="True" />
        </packageRestore>
      
        <activePackageSource>
          <!-- this tells that all of them are active -->
          <add key="All" value="(Aggregate source)" />
        </activePackageSource>
      
        <packageSources>
      
          <add key="PrivatePackages" value="\\TestPath\nuget" />
      
        </packageSources>
      </configuration>

      【讨论】:

        猜你喜欢
        • 2019-11-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2015-08-08
        • 1970-01-01
        • 1970-01-01
        • 2019-03-22
        相关资源
        最近更新 更多