Reputation: 21
We use a nuget.config file in the root of our source control. This way all solutions in this source control get to use the same nuget configuration and therefore the same repositoryPath where nuget downloads restored packages to use.
All across the internet, I find no mention of putting a network share as a repository path of nuget.config files. In my opinion it generally really does make sense to do so.
Why should every developer and build server have to download the nuget-packages from nuget.org themselves, when we could easily specify a single accessible location on e.g. \myTfsServer\Nuget\RepositoryPath?
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<config>
<clear />
<add key="repositoryPath" value="\\myTfsServer\Nuget\RepositoryPath" />
</config>
...
</configuration>
Is there something I clearly miss?
UPDATE: I'm not talking about the sources. The location where a restore downloads all the packages to is what I am talking about. I don't want to check in my restored packages, so I try to bend the repositoryPath outside the source control...
Upvotes: 1
Views: 883
Reputation: 31003
In nuget.config file, there are sections named packageSources and activePackageSource.
packageSources lists all known package sources. activePackageSource identifies to the currently active source or indicates the aggregate of all sources.
To use a network share for NuGet's repositoryPath, you need to add a new key into packageSources
and activePackageSource
sections as below:
<packageSources>
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
<add key="Network Share" value="\\myTfsServer\Nuget\RepositoryPath" />
</packageSources>
<activePackageSource>
<add key="Network Share" value="\\myTfsServer\Nuget\RepositoryPath" />
</activePackageSource>
Upvotes: 1