Skip to content

Latest commit

 

History

History
143 lines (82 loc) · 6.31 KB

nuget-exe.md

File metadata and controls

143 lines (82 loc) · 6.31 KB
title description ms.assetid ms.service ms.topic ms.date monikerRange
Connect to a feed - NuGet.exe
How to connect to an Azure Artifacts feed
10665DBC-846E-4192-8CAB-D5A4C6E40C65
azure-devops-artifacts
conceptual
07/11/2022
<= azure-devops

Connect to Azure Artifacts feeds (NuGet.exe)

[!INCLUDE version-lt-eq-azure-devops]

Azure Artifacts allows developers to both publish and download NuGet packages from various sources, including feeds and public registries. You can use it to privately share packages with your team or specific users and also make them publicly accessible, allowing you to share them openly with anyone on the internet.

Prerequisites

Project setup

::: moniker range=">= azure-devops-2019"

  1. Select Artifacts and then select your feed.

  2. Select Connect to feed.

    :::image type="content" source="../media/connect-to-feed-azure-devops-newnav.png" alt-text="Screenshot showing the connect to feed button":::

  3. Select NuGet.exe from the left panel.

  4. If this is your first time using Azure Artifacts with NuGet.exe, select Get the tools in the top-right corner and follow the instructions to download and install NuGet and Azure Artifacts Credential Provider.

  5. Follow the instructions in the Project setup to set up your nuget.config file.

    :::image type="content" source="../media/nuget-azure-devops-newnav.png" alt-text="Screenshot showing how to set up your project's config file":::

::: moniker-end

::: moniker range="tfs-2018"

  1. Select Build and Release > Packages.

  2. Select your feed from the dropdown menu.

  3. Select Connect to feed.

    :::image type="content" source="../media/connect-to-feed.png" alt-text="Screenshot showing the connect to feed button in TFS":::

  4. Select NuGet from the left panel.

  5. If this is your first time using Azure Artifacts with NuGet, select the link under Get the tools to download and install NuGet and the Credential Provider.

  6. Run the command highlighted in step number two to add your feed URL to your nuget.config file.

    :::image type="content" source="../media/nugeturl.png" alt-text="Screenshot showing how to push your package using NuGet.exe in TFS":::

  7. Run the command highlighted in step number three if you want to publish your NuGet package.

::: moniker-end

Note

Azure Artifacts Credential Provider is supported with NuGet 4.8.2 or later. See Azure Artifacts Credential Provider for more information.

::: moniker range="azure-devops"

Legacy project setup (NuGet v2)

  1. Select Artifacts and then select your feed.

  2. Select Connect to feed.

    :::image type="content" source="../media/connect-to-feed-azure-devops-newnav.png" alt-text="Screenshot showing the connect to feed button":::

  3. Select NuGet.exe from the left panel.

  4. Copy your source URL, and then replace /v3/index.json with /v2.

    :::image type="content" source="../media/nuget-consume-url-azure-devops-newnav.png" alt-text="Screenshot showing the source URL":::

  5. Create a Personal Access Token. Scope your PAT to the organization(s) you want to access and to one of the following scopes: Packaging (read), Packaging (read and write), or Packaging (read, write, and manage).

  6. Run the following command in an elevated command prompt window to add your package source:

    nuget sources add -name <Feed_Name> -source <Feed_URL> -username <Any_String_But_Not_Null> -password <Personal_Access_Token>
  7. If your organization is connected to Microsoft Entra ID, you must first authenticate with your AD credentials and then add your personal access token using the setapikey command:

    nuget sources add -name <Feed_Name> -source <Feed_URL> -username <Azure_Active_Directory_UserName> -password <Azure_Active_Directory_Password>
    
    nuget setapikey <Personal_Access_Token> -source <Feed_URL> 

::: moniker-end

::: moniker range="tfs-2018"

Legacy project setup (NuGet v2)

  1. Select Build and Release > Packages.

  2. Select your feed from the dropdown menu.

  3. Select Connect to feed.

    :::image type="content" source="../media/connect-to-feed.png" alt-text="Screenshot of the connect to feed button in TFS":::

  4. Select NuGet and then copy your source URL. Replace /v3/index.json with /v2.

    :::image type="content" source="../media/nuget-consume-url.png" alt-text="Screenshot showing how to get the source URL":::

  5. Create a Personal Access Token. Scope your PAT to the organization(s) you want to access and to one of the following scopes: Packaging (read), Packaging (read and write), or Packaging (read, write, and manage).

  6. Run the following command in an elevated command prompt window to add your package source:

    nuget sources add -name <Feed_Name> -source <Feed_URL> -username <Any_String_But_Not_Null> -password <Personal_Access_Token>
  7. If your organization is connected to Microsoft Entra ID, you must first authenticate with your AD credentials and then add your personal access token using the setapikey command:

    nuget sources add -name <Feed_Name> -source <Feed_URL> -username <Azure_Active_Directory_UserName> -password <Azure_Active_Directory_Password>
    
    nuget setapikey <Personal_Access_Token> -source <Feed_URL> 

::: moniker-end

Related articles