1
votes

I have the following nuget.config file and bellow is the file content

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <config>
        <add key="repositoryPath" value="Packages" />
    </config>
    <packageRestore>
        <add key="enabled" value="True" />
    </packageRestore>
    <packageSources>
        <!-- Ditch all the Global NuGet package sources we only want a 
         single private NuGet repo for this project -->
        <clear />
        <add key="private="private" />
        <add key="nuget.org" value="https://www.nuget.org/api/v2/" />
    </packageSources>
    <disabledPackageSources>
        <add key="nuget.org" value="false" />
    </disabledPackageSources>
</configuration>

All the packages which exist in the private feed are restored but the same is not happening with the ones in nuget.org:

From VSO build output

Feeds used:

C:\Users\buildguest\AppData\Local\NuGet\Cache

private

https://www.nuget.org/api/v2/

...

Restoring NuGet package AutoMapper.5.2.0.

WARNING: Unable to find version '5.2.0' of package 'AutoMapper'.

This is happening during the NuGet restore step in VSO.

2
I don't know if you just mistyped it here in the question's text or if the actual content of the file is exactly as you put, but this isn't correct: <add key="private="private" />.Alexandre

2 Answers

1
votes

Use NuGet.Protocol.Core.v3 feed protocol with

<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />

instead of

<add key="nuget.org" value="https://nuget.org/api/v2/" />
0
votes

enter image description here Inside Nuget.config put the bellow code.

  <configuration>
      <packageRestore>
        <add key="enabled" value="True"/>
        <add key="automatic" value="True"/>
        </packageRestore>
    </configuration>