Normally, if you want to add a custom NuGet package source, you do this from within Visual Studio:
Tools -> Options -> NuGet Package Manager -> Sources.
However, this means that everyone who wants to build your project has to have those same custom package sources configured, which is annoying.
Another option is to add a
nuget.config file to your solution, containing your custom package sources.
You have to create this file manually, but it’s easy to do, and Visual Studio will pick up on it and allow you to search and list packages from sources defined in it.
This means that everyone working on your project automatically sees the same NuGet package sources, and can fetch the same packages from the same places.
Anyway. Create a file called
nuget.config in the same folder as your solution (
.sln file), with contents similar to:
<?xml version="1.0" encoding="utf-8"?> <configuration> <packageSources> <!-- List your package sources here --> <add key="Stylet" value="https://ci.appveyor.com/nuget/stylet" /> </packageSources> <activePackageSource> <!-- Mark all package sources as active --> <add key="All" value="(Aggregate source)" /> </activePackageSource> </configuration>
You may need to restart Visual Studio to get it to pick up on the new package sources.
The full structure of this file is documented on docs.nuget.org.