How to: NuGet local feeds
Source: Dev.to
Introduction
NuGet packages are the standard way .NET developers share, version, and consume reusable code—whether it’s core libraries, third‑party tools, or internal company components. A NuGet package is essentially a zipped bundle that contains compiled assemblies, metadata, and dependency information, which allows Visual Studio and the .NET CLI to automatically restore the correct versions your project needs.
This system has been around for years, and it works because it enforces consistency: you no longer copy DLLs by hand; instead, you declare what you depend on and let NuGet manage updates, conflicts, and builds in a predictable and repeatable way.
In this article, learn how to write code to publish to a local source.
Individual accounts on NuGet.org
You must create an individual account to publish and manage packages on NuGet.org.
Local feed / source
A NuGet local feed is simply a folder on your machine or network that NuGet treats as a package source, allowing you to create, store, and consume NuGet packages without publishing them to a remote repository like nuget.org.
Local feeds are fast, offline‑friendly, and ideal for in‑house or experimental packages; however, they lack the governance, versioning discipline, and auditability that you get from a proper package server.
When to create local packages
- A developer uses the same code over and over again.
- The code is proprietary to a developer or an organization.
- Easy to maintain and allows multiple versions to be available.
Starter example 1
A developer or team needs to create a type handler for Dapper to understand DateOnly and TimeOnly structs. This could be a local or public package (see the public version here).
public class SqlDateOnlyTypeHandler : SqlMapper.TypeHandler
{
public override void SetValue(IDbDataParameter parameter, DateOnly date)
=> parameter.Value = date.ToDateTime(new TimeOnly(0, 0));
public override DateOnly Parse(object value) => DateOnly.FromDateTime((DateTime)value);
}
public class SqlTimeOnlyTypeHandler : SqlMapper.TypeHandler
{
public override void SetValue(IDbDataParameter parameter, TimeOnly time)
{
parameter.Value = time.ToString();
}
public override TimeOnly Parse(object value) => TimeOnly.FromTimeSpan((TimeSpan)value);
}
Starter example 2
A developer or a team develops a proprietary API that is used only internally. These packages need to be protected; otherwise, a hacker could easily obtain the source code. A package file is just as easy to hack as a .dll file.
Publishing to a local feed / source – tool
The purpose of the tool is to copy a package file to a local feed folder for personal use or for a team of developers.
- Source code:
Screenshot
Using the tool
- Select a package.
- Select a version of the package.
- Click the Publish button.
- A confirmation dialog appears; click Yes to continue.
- If the package already exists, it will be overwritten.
Configuration
To configure the tool, open appsettings.json.
PackageLocation
Points to the folder where your local NuGet packages are stored for Microsoft Visual Studio.
Visual Studio options dialog for NuGet package sources

ProjectItems section
Add one or more paths to project folders that contain one or more .nupkg files.
- The path points to a project folder, not directly to the
.nupkgfiles. - Paths can belong to one or more Visual Studio solutions.
Example appsettings.json (five paths)
{
"PackageLocation": "C:\\NuGetLocal",
"ProjectItems": [
{ "Path": "C:\\DotnetLand\\VS2022\\ProjectTemplates2025\\SpectreConsoleLibrary" },
{ "Path": "C:\\DotnetLand\\VS2022\\BogusTrainingSolution\\BogusLibrary" },
{ "Path": "C:\\DotnetLand\\VS2022\\SerilogSolution\\SeriLogThemesLibrary" },
{ "Path": "C:\\DotnetLand\\VS2022\\ConsoleHelpersSolution\\ConsoleConfigurationLibrary" },
{ "Path": "c:\\DotnetLand\\VS2019\\dapper-libraries\\Dapper.Handlers" }
]
}
Important
💡 The method DirectoryHelper.ProjectItems traverses the folders specified in ProjectItems of appsettings.json. Only paths that exist and contain a .nupkg file will be processed.
At least one .nupkg will be displayed in the tool.
Summary
Instructions and why a developer or team of developers may want to use local NuGet packages, along with a tool to copy packages to a local feed folder, in this article to assist with working with local NuGet packages.
