Does anybody know how to add custom package source to Visual Studio Code?
E.g. I\'d like to add https://www.myget.org/F/aspnet-contrib/api/v3/index.
You can add a NuGet.config file and specify the package source in there. Some reference docs: https://docs.microsoft.com/en-us/nuget/schema/nuget-config-file
Note - if your custom package source is password protected, then the credentials should also be part of the config file.
<packageSourceCredentials>
<MyGet> <!--package src name-->
<add key="Username" value="something" />
<add key="ClearTextPassword" value="thepassword" />
</MyGet>
</packageSourceCredentials>
And for anyone wondering why the credentials have to be in clear text (which defeats the whole purpose of having credentials in the first place, since this config file will also go into source control).
This is an open issue in dotnet / nuget cli. Ref github issue # 5909 & 1851
To add to the answer, adding a nuget.config
in the project solves it for the project. Adding to the root is ok. The config could look like this:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="MyGet" value="https://www.myget.org/F/aspnet-contrib/api/v3/index.json" />
</packageSources>
</configuration>