DEV Community

Daniel Leinweber
Daniel Leinweber

Posted on

1

Create a NuGet-Package

In my day-to-day job we have a lot of projects that need to pull in the same internal libraries over and over again.

So we decided to create NuGet-Packages for these libraries and create a local feed, from which we can pull in the NuGet-Packages from our different projects.

These are the steps to create your own NuGet-Packages and use your own local feed.

1. Create a manifest

The .nuspec file is the NuGet-Packages manifest and defines the different values of the package. Like the name, description, version, etc..

You can run the following command in a developer command line to create the manifest file.

nuget spec
Enter fullscreen mode Exit fullscreen mode

2. Create a package

You can execute the following command in a developer command line to actually create the package, based on the previously created manifest.

nuget pack
Enter fullscreen mode Exit fullscreen mode

3. Add NuGet-Package to local feed

To add the created NuGet-Package to a local feed you can execute the following command in a developer command line.

nuget add MyPackage.1.0.0.nupkg --source \\my_server\my_local_feed_share
Enter fullscreen mode Exit fullscreen mode

4. Add local feed to Package sources

To actually find the NuGet-Packages from the local feed, you need to add it to the package sources.

In Visual Studio navigate to Tools > Options > Nuget Package Manager > Package Sources and click on the green + icon to add a new source. Provide a name and a source for your local feed.

After that you are able to browse your local feed when managing NuGet-Packages for a project.

Postmark Image

Speedy emails, satisfied customers

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay