“Unable to find version” during TFS Build 2015 when restoring NuGet packages

前端 未结 4 1639
忘了有多久
忘了有多久 2020-12-31 03:24

I\'m having troubles with NuGet package restoring during a TFS Build 2015.

Since some packages require NuGet 3.x client, I\'ve configured the new scriptable build to

相关标签:
4条回答
  • 2020-12-31 03:31

    If for some reason updating the NuGet.config in the Roaming folder is not an option or unwanted, it is also possible to add the config file to the solution root.

    According to the docs:

    • Project-specific NuGet.Config files located in any folder from the solution folder up to the drive root. These allow control over settings as they apply to a project or a group of projects.
    • A solution-specific NuGet.Config file located within a .nuget folder in the solution. Settings in this file apply only to solution-wide packages and is supported only in NuGet 3.3 and earlier. It is ignored for NuGet 3.4 and later.

    Config file locations and uses

    0 讨论(0)
  • 2020-12-31 03:32
    1. Your project folder must contain 'packages' folder and in that 'packages' folder all of the packages dlls should be present.
    2. Your project references should point to those packages dlls.
    0 讨论(0)
  • 2020-12-31 03:37

    In my case, the issue was that user-wide NuGet.config located at C:\Users\[User name]\AppData\Roaming\NuGet\NuGet.config (where [User name] is the user who's running the build agent's Windows service) was pointing to NuGet API v2 while my build is already using NuGet Command-Line 3.x.

    <?xml version="1.0" encoding="utf-8"?>
    <configuration>
      <packageSources>
        <add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
        <!-- CHANGING V2 TO V3 IN THE URI VALUE SOLVED THE ISSUE! -->
        <add key="nuget.org" value="https://www.nuget.org/api/v3/" />
      </packageSources>
    </configuration> 
    
    0 讨论(0)
  • 2020-12-31 03:44

    In my case the Nuget.Config, was in:

    C:\Windows\ServiceProfiles\NetworkService\AppData\Roaming\NuGet
    

    So search for Nuget.Config in your C:\.

    The user depends on the account that you configured the Agent

    0 讨论(0)
提交回复
热议问题