Use dotnet with VSTS feeds

VSTS

Note

This page covers interactive scenarios. In Team Build, use the .NET Core step.

To use dotnet with VSTS NuGet feeds, you'll need to specify a Personal Access Token in plain text.

On Windows, NuGet 4 is functionally equivalent to dotnet, and we recommend using that instead.

Add a feed to dotnet

Generate a Personal Access Token (PAT) using the instructions here. Scope your PAT to the account(s) you want to access and to one of the following scopes: Packaging (read), Packaging (read and write), or Packaging (read, write, and manage).

We strongly recommend not checking your PAT into source control; anyone with access to your PAT can interact with VSTS as you.

Then, create or edit a NuGet.config file in the same directory as your csproj that contains your feed as a packageSource with an accompanying packageSourceCredentials section and a ClearTextPassword key. You can copy the example below. Replace your-feed-name, http://your-feed, and your-pat with appropriate values.

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <add key="your-feed-name" value="http://your-feed" />
  </packageSources>
  <packageSourceCredentials>
    <your-feed-name>
      <add key="Username" value="any-value-here" />
      <add key="ClearTextPassword" value="your-pat" />
    </your-feed-name>
  </packageSourceCredentials>
</configuration>

For more help with creating a NuGet.config, see the config file reference.