Skip to content

Instantly share code, notes, and snippets.

@finesse-fingers
Last active April 27, 2020 06:06
Show Gist options
  • Save finesse-fingers/cb32a33488d1259a8e5e467e0ccf948c to your computer and use it in GitHub Desktop.
Save finesse-fingers/cb32a33488d1259a8e5e467e0ccf948c to your computer and use it in GitHub Desktop.

Prerequisite

Install https://github.com/Microsoft/artifacts-credprovider

Project setup

Add a nuget.config file to your project, in the same folder as your .csproj or .sln file. E.g.:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <clear />
    <add key="{displayName}" value="{url}/index.json" />
  </packageSources>
</configuration>

Restore packages

Restore packages (using the interactive flag, which allows dotnet to prompt you for credentials)

dotnet restore --interactive

Note: You don't need --interactive every time. dotnet will prompt you to add --interactive if it needs updated credentials.

Alternative: Using PAT (Personal Access Token)

  1. Generate an Azure DevOps PAT
  2. Add nuget source the usual way in VS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment