Introduction
NuGet is the most useful and essential tool for modern software development platforms via which developers can create, share and consume reusable code. Those useful or reusable common codes are compiled as DLLs and published as packages with code-related files and other information, including the version number.
The nuget.org doesn't allow permanently deleting the already published packages because if you delete the package after a few days/hours of publishing it, others might have already used it, and their project can be broken. Because of this reason, NuGet does not allow for deletion. So before publishing your package, you must verify the package functionality properly. You must test it locally before publishing it in the package store (nuget.org). Additionally, sometimes organizations don't want to use online packages or restrict to use of online packages. They just download and store the valid packages locally or somewhere in the private cloud and then ask a developer to use them from the local or private cloud storage. For this scenario, this article guides you through configuring and utilizing the package.
This article demonstrates how to create a NuGet package using Visual Studio and test it locally before publishing it to nuget.org. In addition, we will learn to create a nupkg file and configure the NuGet manager for local testing in Visual Studio before publishing it to NuGet. Basically, this article focuses on how to configure and set up a test environment locally to test the package before publishing it. Testing and verifying depend upon the package you built; however, this article explains the technique and process to configure and test the package locally.
If you are new to NuGet package creation, a previous article on creating and publishing a NuGet package can be found here.
Prerequisites
- Visual Studio 2022
Create or Update Class Library Project
Case I: New package
If you are creating the NuGet package for the first time, you can also test it before publishing it. First, complete the code for your class library project that you will publish in the package store. After that, you can follow the below steps to test it locally before publishing it to the NuGet store.
Case II: If updating new features or fixing issues of the existing package project.
Open your class library project and update the new changes for your project. Once updated, we need to test the package before publishing it.
Create a Local Feed and Publish the Package
Step 1. Create a local feed to store the NuGet
Firstly we will create a new folder in your drive, such as in C:\ drive. You can create a folder with the name: local.nuget. Here we will store the package locally.

Step 2. Configure Package Manager for Local feed
After that, Open Visual Studio and go to Tools-> Nuget Package Manager ->Package Manager Settings, as portrayed below.








amit agarwalPosted Jan 31, 2024, 2:08 PM
Article not valid as we can not debug NuGet package code by above steps