<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<clear />
<add key="artifact-feed-name" value="https://pkgs.dev.azure.com/<organization>/_packaging/<artifact-feed-name>/nuget/v3/index.json" />
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
</packageSources>
<packageSourceCredentials>
<artifact-feed-name>
<add key="Username" value="<Usually Azure Devops Account Email Address>" />
<add key="ClearTextPassword" value="<Personal Access Token>" />
</artifact-feed-name>
</packageSourceCredentials>
</configuration>
In, <add key="ClearTextPassword" value="<Personal Access Token>" />
the value needs to be changed every 90 days. Basically, value is PAT created from Azure devops account.
dontnet pack <project-name>.csproj --output <output-folder>
-
Install Nuget.exe from Nuget Downloads. Download the recommended one
-
Copy .exe file to C drive and make the folder called nuget and paste it in there.
-
Folder path should be look like this C:\nuget\
-
Add this path under the System variables. For the demo Click here
-
This steps required because now, you can access nuget anywhere from the system.
nuget push -Source "<Feedname>" -ApiKey az <Package-name>.nupkg
nuget push -Source "online-ordering-artifacts" -ApiKey az FTXCore.Services.Identity.Integration.1.1.1.nupkg
You should open the cmd where is your current package is or the other way, provide the absolute path of the package.
Once the command is fired, you'll be prompted to enter the Microsoft account credentials for the authentication.
For the confirmation that the package is successfully uploaded to the azure devops feed, You'll see something like this at the end of the command process
PUT https://pkgs.dev.azure.com/ftxinfotech/_packaging/4400b28f-d2bd-432d-b34d-62ae3d519c6b/nuget/v2/ Accepted https://pkgs.dev.azure.com/ftxinfotech/_packaging/4400b28f-d2bd-432d-b34d-62ae3d519c6b/nuget/v2/ 5347ms Your package was pushed.
Run this command at the root of the project where the .csproj file or package.config exists.
nuget restore
Q. While pushing the package got the ,
The specified source 'MySource' is invalid. Please provide a valid source.
A. nuget sources Add -Name "MySource" -Source <url>
Here "MySource"
is the feed name and <url>
is the artifact feed url.
Example
nuget sources Add -Name "<feed-name>" -Source https://pkgs.dev.azure.com/<organization>/_packaging/<feed-name>/nuget/v3/index.json
Q. Getting 401 Unauthorized while restoring artifacts.
A. This may occure if you're restoring packages with dotnet restore
. Please try restoring using the nuget restore
.