Poor man's NuGet feed

March 12, 2018 | 2 Minute Read

Lately I have been writing .NET Core APIs on Windows and testing them in Ubuntu because one of the dependencies fails to work on Windows. These APIs use a library for some shared functionality and I had to make them available when I am working on the other machine. There are no free NuGet feeds available that will keep your packages private. I decided to use a Git repository to share the feed since there are a few free Git hosting services.

I created a folder named nuget-feed along with my other project folders and initialized it as a Git repo. To make sure that the projects see this folder as a package source, we need to create a NuGet.config in the same folder that contains the solution file for every project. Be careful with the casing for the filename because if it’s not exactly the same, it will be ignored.

This script requires .NET Core CLI and some Unix tools to be in the path. Fortunately, Git for Windows installation takes care of that for us so it will work on Windows too. Modify the paths as you like and save it as pack.sh in your library repository. You can pack and push your package in a single step by running this script.