To enable NuGet package restore from multiple repositories you have to edit the NuGet.targets file in the .nuget solution folder.

<ItemGroup Condition=" '$(PackageSources)' == '' ">
    <!-- Package sources used to restore packages. By default, registered sources under %APPDATA%\NuGet\NuGet.Config will be used -->
    <!-- The official NuGet package source (https://nuget.org/api/v2/) will be excluded if package sources are specified and it does not appear in the list -->
    <PackageSource Include="https://nuget.org/api/v2/" />
    <PackageSource Include="\\\\my-server\\my-packages\\" />
</ItemGroup>

Important: escape the backslashes in the file share path, or you’ll get a very cryptic error message!

NuGet package restore with multiple repositories and file shares
Tagged on:

One thought on “NuGet package restore with multiple repositories and file shares

  • July 20, 2013 at 1:36 am
    Permalink

    Thanks for pointing out on slashes espace!

Leave a Reply

Your email address will not be published. Required fields are marked *