Add a Package to a .NET Core Project

Working with packages in any software development project is a common practice and can save time and effort. For .NET development, the main package repository is Nuget.org.

.NET is no different to other programming languages and allow developers to use open-source and community-developed libraries that we can download to our project and use.

Package Managment

To get started, let create a new C# dotnet application using the following command.

Dotnet new console

After creating a console application, let us add a package from NuGet. The package name is humanizer, and I will use the following command to install it.

dotnet add package Humanizer --version 2.11.10

After adding the package, We need to add it to the Program.cs file below the System namespace and as shown below.

using System;
using Humanizer;

To list all the packages used in our code and application, run the following command or review the .csproj file.

dotnet list package

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.