Search This Blog

Saturday, 26 April 2025

Creating a NuGet Package Feed to Host Artifacts

Step-by-Step Guide: Creating a NuGet Package Feed to Host Artifacts

🔹 Step 1: Create a C# Class Library and Generate NuGet Package

  1. Open Visual Studio.
  2. Go to File → New → Project.
  3. Select Class Library (.NET Standard) or .NET Framework.
  4. Name the project (e.g., ClassLibrary1) and click Create.
  5. Right-click the project in Solution Explorer and select Properties.
  6. Go to the Package tab.
  7. Check Generate NuGet package on build.
  8. Fill in metadata fields as needed (Package ID, Version, Author, etc.).
  9. Build the project in Release mode.

Note: The .nupkg file will be generated in bin\Release\.

🔹 Step 2: Set Up a NuGet Feed in Azure DevOps

  1. Go to Azure DevOps Portal and log in.
  2. Create a new project named Own-Artifacts.
  3. Click Create.
  4. In the left-hand menu, click Artifacts.
  5. Click + Create Feed.
  6. Enter the following:
    • Name: Feed-OwnNuGet
    • Visibility: People in your cloud user
  7. Click Create.

🔹 Step 3: Publish the NuGet Package to Azure DevOps Feed

  1. Ensure nuget.exe is installed and available in your system path.
  2. Open a Command Prompt or Developer Command Prompt.
  3. Run the following command:
nuget.exe push -Source "https://pkgs.dev.azure.com/clouduser/Own-Artifacts/_packaging/Feed-OwnNuGet/nuget/v3/index.json" -ApiKey az "D:\hc-git\ClassLibrary1\bin\Release\ClassLibrary-hc1.1.0.0.nupkg"

Note: Replace the path with the actual location of your .nupkg file.



NuGet Feed

✅ Summary

  • You created a class library and generated a NuGet package.
  • You set up a private NuGet feed in Azure DevOps.
  • You published the package to your own feed.

Creating a NuGet Package Feed to Host Artifacts

Step-by-Step Guide: Creating a NuGet Package Feed to Host Artifacts 🔹 Step 1: Create a C# Class Library and Generate NuG...

Recent Post