DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Newsletter
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Related

  • How To Publish and Install DotNet SDK With NuGet
  • Publishing Flutter Packages to JFrog Artifactory
  • Wow, pnpm, You’re Really Fast
  • How To Approach Dependency Management in Java [Video]

Trending

  • Build a GitHub Contribution City With Java and Quarkus
  • Searching Kafka Without an Index: Lessons From Building Message Search for Kafdrop
  • How to Migrate From LangChainGo to Genkit Go
  • Build a Voice Assistant With Gemini Live API

Draft This article hasn't been published, so readers can't see it.

In moderation This article is waiting for review, so readers can't see it yet.

Deleted This article has been deleted, so readers can't see it.

  1. DZone
  2. Testing, Deployment, and Maintenance
  3. Deployment
  4. Install NuGet Packages in Visual Studio

Install NuGet Packages in Visual Studio

NuGet packages a hugely important part of the .NET ecosystem. Learn how to get NuGet packages installed and running on your machine.

By 
Faisal Pathan
·
Oct. 17, 18 · Tutorial
Post on X (opens in a new tab) Share on LinkedIn (opens in a new tab)
172.2K Views

Join the DZone community Save articles, join the discussion, and download Refcards and Trend Reports with a free account.

Join for free Already a member? Log in

Introduction

NuGet packages are pre-defined pieces of code which are reusable for other developers. You can add a NuGet package to your project and use it's functionality wherever you want in your project. We can also say that NuGet behaves like a platform, where developers can create and share code with the world. It contains code that's compiled as DLL which is nearly impossible to decrypt. 

Prerequisites

  • Visual Studio

Step 1: Create a Project

  • We can install NuGet packages in any .NET project which supports the same target framework as our project.
  • For this demo, I'm using a standard MVC Project.
    Install NuGet packages in Visual StudioInstall NuGet packages in Visual Studio

Step 2: Open the NuGet Package Manager

Now, there are two options for opening the Nuget Package Manager window.

  1. Select Tools > Nuget Package Manager > Manage Nuget Packages for Solution.      

Install NuGet packages in Visual Studio

2. Go to your Solution Explorer, right-click on References, and choose Manage NuGet Packages.

Install NuGet packages in Visual Studio

Step 3: Search and Install Your Required NuGet Package

Install NuGet packages in Visual Studio

  • In this window, you can search for, install, uninstall and update any Nuget Package. You can also see a full list of your installed NuGet packages.
  • Once you click on the Install button and click on 'I Agree' in the permissions pop-up window, then that particular package will be installed/added to your project.
  • Here, I am installing the EntityFramwork Nuget Package.

Once the package is installed successfully, this message will be displayed.

Install NuGet packages in Visual Studio Here, You can see your installed project. Go to Solution Explorer > Reference, and expand it.

Install NuGet packages in Visual StudioNow you can access that package/code from your project.  

Note: You can also install NuGet packages for multiple projects at the same time and in the same place.

Installing NuGet Using the Package Manager Console

Step 1: Select Tools > NuGet Package Manager > Package Manager Console

Install NuGet packages in Visual Studio It will open the console at the bottom of the window. 

Step 2: Select Your Project and Execute the Below Command to Install the Package

Install NuGet packages in Visual StudioIf your command is valid, then the package will be installed in your project.

NuGet Package manager

Opinions expressed by DZone contributors are their own.

Related

  • How To Publish and Install DotNet SDK With NuGet
  • Publishing Flutter Packages to JFrog Artifactory
  • Wow, pnpm, You’re Really Fast
  • How To Approach Dependency Management in Java [Video]

Partner Resources

×

Comments

Loading comments

The comments didn't load

Please try again in a moment.

Likes

Loading

The next likes didn't load. Please try again.

The likes didn't load

Please try again in a moment.

See who liked this

Log in or join DZone for free to see who liked this article.

Log in Join for free
  • RSS
  • X
  • Facebook

ABOUT US

  • About DZone
  • Support and feedback
  • Community research

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 215
  • Nashville, TN 37211
  • [email protected]

Let's be friends:

  • RSS
  • X
  • Facebook