Skip to content

Commit 7f086e1

Browse files
Merge pull request #8336 from MicrosoftDocs/artifacts/482876
publish to feeds (dotnet)
2 parents df305af + b0c05dd commit 7f086e1

File tree

2 files changed

+78
-33
lines changed

2 files changed

+78
-33
lines changed

docs/artifacts/nuget/dotnet-exe.md

Lines changed: 75 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ ms.assetid: CA2DCB9D-93FB-4E2D-B953-BF78D5687B35
55
ms.service: azure-devops-artifacts
66
ms.custom: devx-track-dotnet
77
ms.topic: tutorial
8-
ms.date: 01/13/2025
8+
ms.date: 09/18/2025
99
monikerRange: '>= azure-devops-2020'
1010
---
1111

@@ -17,12 +17,28 @@ This guide walks you through configuring your project to publish NuGet packages
1717

1818
## Prerequisites
1919

20-
| **Product** | **Requirements** |
21-
|--------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
20+
| **Product** | **Requirements** |
21+
|--------------------|--------------------------------------------|
2222
| **Azure DevOps** | - An Azure DevOps [organization](../../organizations/accounts/create-organization.md).<br>- An Azure DevOps [project](../../organizations/projects/create-project.md).<br> - An Azure Artifacts [feed](../get-started-nuget.md#create-a-feed).<br> - Download and install the [Azure Artifacts Credential Provider](https://github.com/microsoft/artifacts-credprovider).<br> - Download and install [.NET Core SDK (2.1.400+)](https://dotnet.microsoft.com/en-us/download). |
2323

24+
## Create a feed
25+
26+
If you already have a feed, proceed to the next step. Otherwise, follow the instructions below to create a new one:
27+
28+
1. Sign in to your Azure DevOps, and navigate to your project.
29+
30+
1. Select **Artifacts**, and then select **Create Feed**.
31+
32+
1. Enter a descriptive **Name** for your feed and define its **Visibility** (who can use your feed). Specify the **Scope** of your feed, and if you wish to include packages from public sources, check the **Include packages from common public sources** checkbox.
33+
34+
1. Select **Create** when you're done.
35+
2436
## Connect to a feed
2537

38+
Before you can publish packages to your feed, you must authenticate with Azure Artifacts. Follow the instructions below to set up your project and authenticate with your feed:
39+
40+
#### [Project scoped feed (Recommended)](#tab/projectscoped)
41+
2642
::: moniker range="azure-devops"
2743

2844
1. Sign in to your Azure DevOps organization, and then navigate to your project.
@@ -33,29 +49,54 @@ This guide walks you through configuring your project to publish NuGet packages
3349

3450
1. Create a *nuget.config* file in the same folder as your *csproj* or *sln* file. Copy the following XML snippet and paste it into your new file, replacing the placeholders with the relevant information:
3551

36-
- Organization-scoped feed:
52+
```xml
53+
<?xml version="1.0" encoding="utf-8"?>
54+
<configuration>
55+
<packageSources>
56+
<clear />
57+
<add key="<FEED_NAME>" value="https://pkgs.dev.azure.com/<ORGANIZATION_NAME>/<PROJECT_NAME>/_packaging/<FEED_NAME>/nuget/v3/index.json" />
58+
</packageSources>
59+
</configuration>
60+
```
3761

38-
```xml
39-
<?xml version="1.0" encoding="utf-8"?>
40-
<configuration>
41-
<packageSources>
42-
<clear />
43-
<add key="<FEED_NAME>" value="https://pkgs.dev.azure.com/<ORGANIZATION_NAME>/_packaging/<FEED_NAME>/nuget/v3/index.json" />
44-
</packageSources>
45-
</configuration>
46-
```
62+
::: moniker-end
4763

48-
- Project-scoped feed:
64+
::: moniker range="azure-devops-2020 || azure-devops-2022"
65+
66+
1. Sign in to your Azure DevOps server, and then navigate to your project.
67+
68+
1. Select **Artifacts**, and then select your feed.
69+
70+
1. Select **Connect to Feed**, and then select **dotnet** from the left navigation pane.
71+
72+
1. Follow the instructions in the **Project setup** section to connect to your feed.
73+
74+
:::image type="content" source="../media/connect-to-feed-dotnet-server-2020-and-2022.png" alt-text="A screenshot showing how to connect to a feed with dotnet in Azure DevOps Server 2020 and 2022." lightbox="../media/connect-to-feed-dotnet-server-2020-and-2022.png":::
75+
76+
::: moniker-end
77+
78+
#### [Organization scoped feed](#tab/organizationscoped)
79+
80+
::: moniker range="azure-devops"
81+
82+
1. Sign in to your Azure DevOps organization, and then navigate to your project.
83+
84+
1. Select **Artifacts**, and then select your feed from the dropdown menu.
85+
86+
1. Select **Connect to feed**, and then select **dotnet** from the *NuGet* section on the left.
87+
88+
1. Create a *nuget.config* file in the same folder as your *csproj* or *sln* file. Copy the following XML snippet and paste it into your new file, replacing the placeholders with the relevant information:
89+
90+
```xml
91+
<?xml version="1.0" encoding="utf-8"?>
92+
<configuration>
93+
<packageSources>
94+
<clear />
95+
<add key="<FEED_NAME>" value="https://pkgs.dev.azure.com/<ORGANIZATION_NAME>/_packaging/<FEED_NAME>/nuget/v3/index.json" />
96+
</packageSources>
97+
</configuration>
98+
```
4999

50-
```xml
51-
<?xml version="1.0" encoding="utf-8"?>
52-
<configuration>
53-
<packageSources>
54-
<clear />
55-
<add key="<FEED_NAME>" value="https://pkgs.dev.azure.com/<ORGANIZATION_NAME>/<PROJECT_NAME>/_packaging/<FEED_NAME>/nuget/v3/index.json" />
56-
</packageSources>
57-
</configuration>
58-
```
59100
::: moniker-end
60101

61102
::: moniker range="azure-devops-2020 || azure-devops-2022"
@@ -72,6 +113,8 @@ This guide walks you through configuring your project to publish NuGet packages
72113

73114
::: moniker-end
74115

116+
---
117+
75118
## Publish packages to a feed in the same organization
76119

77120
Run the following command to publish a package to your feed. Replace the placeholders with the appropriate values:
@@ -86,13 +129,12 @@ dotnet nuget push --source https://pkgs.dev.azure.com/<ORGANIZATION_NAME>/<PROJE
86129
dotnet nuget push --source https://pkgs.dev.azure.com/MyOrg/MyProject/_packaging/MyFeed/nuget/v3/index.json --api-key AZ bin/MyPackage.5.0.2.nupkg
87130
```
88131

89-
90132
> [!NOTE]
91-
> The `api-key` is required, but you can provide any string as its value when publishing to an Azure Artifacts feed.
133+
> The `api-key` parameter is required when publishing to an Azure Artifacts feed, but you can use any string as its value.
92134
93-
## Publish packages to a feed in another organization
135+
## Publish packages to a feed in a different organization
94136

95-
To publish your NuGet packages to a feed in a different Azure DevOps organization, you must first create a personal access token (PAT) in the target organization.
137+
To publish your NuGet packages to a feed in a different Azure DevOps organization, you must first create a personal access token (PAT) in the target organization, add the new package source to your configuration file, and then run the publish command:
96138

97139
1. Navigate to the organization hosting the target feed and create a [personal access token](../../organizations/accounts/use-personal-access-tokens-to-authenticate.md) (PAT) with **Packaging** > **Read & write** scope.
98140

@@ -117,11 +159,13 @@ dotnet nuget push --source MySource --api-key AZ nupkgs/mypackage.1.1.0.nupkg
117159
```
118160

119161
> [!NOTE]
120-
> If your organization is using a firewall or a proxy server, make sure you allow the [Azure Artifacts Domain URLs and IP addresses](../../organizations/security/allow-list-ip-url.md#azure-artifacts).
121-
162+
> If your organization uses a firewall or proxy server, make sure that the [Azure Artifacts Domain URLs and IP addresses](../../organizations/security/allow-list-ip-url.md#azure-artifacts) are allowed.
122163
123164
## Related content
124165

125-
- [Restore NuGet packages (dotnet)](restore-nuget-packages-dotnet.md)
166+
- [Publish NuGet packages (NuGet.exe)](publish.md)
167+
126168
- [Publish packages with Azure Pipelines (YAML/Classic)](../../pipelines/artifacts/nuget.md)
127-
- [Use packages from NuGet.org](./upstream-sources.md)
169+
170+
- [Restore NuGet packages (dotnet)](restore-nuget-packages-dotnet.md)
171+

docs/artifacts/nuget/publish.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,10 @@ nuget push nupkgs/mypackage.1.1.8.nupkg -src MySource -ApiKey AZ
117117
118118
## Related content
119119

120-
- [Restore NuGet packages (NuGet.exe)](restore-nuget-packages-nuget-exe.md)
120+
- [Publish NuGet packages (dotnet)](dotnet-exe.md)
121121

122122
- [Publish packages with Azure Pipelines (YAML/Classic)](../../pipelines/artifacts/nuget.md)
123123

124-
- [Use packages from NuGet.org](./upstream-sources.md)
124+
- [Restore NuGet packages (NuGet.exe)](restore-nuget-packages-nuget-exe.md)
125+
125126

0 commit comments

Comments
 (0)