Terug naar overzicht

NuGet Package Explorer

Door Bruno Latte

.NET Core .NET Standard

Apr 2021

The other day I came across this nifty little tool that I just had to share with you. It’s called NuGet Package Explorer and lets me create NuGet packages in a few easy steps.

It can be found on GitHub at /NuGetPackageExplorer/NuGetPackageExplorer .  

So, what is it?  

I can’t say it better than the creators so here’s a quote. 

“NuGet Package Explorer (NPE) is an application that makes it easy to create and explore NuGet packages. You can load a .nupkg or .snupkg file from disk or directly from a feed such as nuget.org.”  

You can get it from the Microsoft store. Why they chose to use the Microsoft store, I don’t know. But it was a minor inconvenience I ran into because sometimes companies block this (as it was in my case). They offer different alternatives, just check it on their GitHub page.
Now, a nuget package is nothing more than a zip file with some metadata. If you didn’t know, you can find out more at Microsoft docs (/en-us/nuget/what-is-nuget). This post is not about how to structure a nuget package yourself, that’s what the tool is for . If you want to explore and see how others have structured their packages, you can and you might learn something on the way. For this article though we’ll use it to create the folder structure and necessary xml metadate files for us. 

Why use a tool to create nuget packages? 

Why not create it directly in a build pipeline for example? 

Well, you could have some old 3rd-party libraries lying around that are still in use but don’t exist on nuget.org. In my case the company went out of business, but my customer was still using its libraries, hey they still worked! 
Or you could package a company style (CSS stylesheet, logos, some JavaScript, …) into 1 distributable package to be used in the company’s MVC projects. NuGet is not only for libraries. 

Let’s use the tool to create a company style package 

We’ll have a stylesheet, a logo and some JavaScript that is used on all our web applications. They’re always in a Styles, Images and Scripts folder in our solutions. 

Start NuGet Package Explorer (NPE) and choose “Create a new package” in the startup screen. You’ll see a split screen with on the left the metadata information and on the right is where you’ll create the folder structure. 

Start with adding a folder structure on the right pane. There are a couple of defaults to choose from, but the 2 most common to use are: 

  • Content folder: add any content type that doesn’t need a reference in your solution (exactly what we need). 

  • Lib folder: add any library that needs a reference. 

Note: The content folder on .NET Core projects doesn’t seem to have any effect. /questions/40469058/nuget-content-files-in-net-core-solution-not-getting-copied-when-installing-thr . 

Right click on the right pane and choose “Add Content folder”. If you have the files already in a folder structure you can just drag-n-drop them on the content folder else add folders and files as needed.  

Next add the metadata by clicking on the “Edit Metadata” button . Minimal required fields are marked in bold. Id must be unique of course. Version will allow update notification (e.g., Visual Studio update tab in NuGet manager). 
When done click the checkmark to save the metadata. If you don’t, it’s gone when you add anything to the content on the right!

With the metadata saved, save the file as a .nupkg. 

Now that you have a nuget package, you can add it to Visual Studio using the NuGet package manager. 

I just used a local resource here as an example, but in a next step we’ll host the package in Azure so you can share it with the rest of your development team. But that will be for a next post, hope to see you there. 

Application Logging – “That warm fuzzy blanket for when production doesn’t behave” Thumb

Door Steven Hillaert

Nov 2023

Application Logging – “That warm fuzzy blanket for when production doesn’t behave”

Whenever I see a codebase that has logs, I feel safe. Because when things start to break, I know I’ll have data to help me fix it.

Enabling (as) the next generation software developers Thumb

Door Ruben Verheyen

Oct 2022

Enabling (as) the next generation software developers

Wij zijn allemaal AllPhi. Ieder van ons maakt deel uit van het grote geheel en kan vanuit z’n eigen positie z’n steentje bijdragen. En wanneer we er bewust ...

AllPhi Culture
.NET MAUI, a bright and shiny new bit of technology Thumb

Door Mathias Peene

Aug 2022

.NET MAUI, a bright and shiny new bit of technology

What’s my next experience with MAUI? I’m probably going to continue playing around with the MonkeyFinder application, just to get to know the framework ...

.NET Core .NET Standard
Cache primary btn default asset Cache primary btn hover asset Cache white btn default asset Cache white btn hover asset