Q:

Mixing packages from nuget.org and repository folder in VSTS

My solution grabs some nuget packages from Nuget.org and some of them are in my repository under the "lib" folder. I am aware that having packages in my repository is not the best option, but for now, i am stuck with it.
In my solution nuget.config looks like this :
<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
    <add key="CustomSource" value="../lib" />
  </packageSources>
    <activePackageSource>
    <add key="All" value="(Aggregate source)"  />
  </activePackageSource>
  <solution>
    <add key="disableSourceControlIntegration" value="true" />
  </solution>
</configuration>

It works fine in Visual Studio. 
In VSTS I changed the nuget restore task option :

My build fails like this: 

The nuget command failed with exit code(1) and error(Failed to
  retrieve information about
  'Microsoft.Extensions.Configuration.Abstractions' from remote source
  'D:\a\1\lib'.)
Packages failed to restore

Obviously, Microsoft.Extensions.Configuration.Abstractions, is supposed to download from nuget.org. What should I change so it tries to use the 2 nuget sources?
Thanks!

A:

If you specify your own NuGet.config file in NuGet restore task, it will save the content of the specify NuGet.config file to a temporary config file like: D:\a\1\Nuget\tempNuGet_3274.config.
So If you are using Hosted agent, you should specify the local feed path as:
<add key="CustomSource" value="../s/Projectname/lib" />

Besides, you can also use private agent which locate in your local machine, so that the packages can be found from other directory.

