Visual Studio Package Manager Console

I want to change bigger font size to PowerShell Package Manager Console in Visual Studio. But I couldn't find anyways to change it. I already google a lot but couldn't find anything that worked. When you install nupack (which seems likely to be renamed nuget in the near future), you get a new dockable Visual Studio 2010 window called the Package Manager Console which allows you to run nupack commands right from within VS2010. The great thing about this window is that it can be used for more than just nupack commands. Updating a package simply means installing an updated version, which often restores a package to working order. In Visual Studio, the Package Manager Console provides many flexible options for updating and reinstalling packages. Updating and reinstalling packages is accomplished as follows.

  1. Visual Studio Package Manager Console Initializing Powershell Host
  2. Visual Studio 2017 Package Manager Console
  3. Visual Studio Package Manager Console
-->

NuGet packages contain reusable code that other developers make available to you for use in your projects. See What is NuGet? for background. Packages are installed into a Visual Studio project using the NuGet Package Manager, the Package Manager Console, or the dotnet CLI. This article demonstrates the process using the popular Newtonsoft.Json package and a Windows Presentation Foundation (WPF) project. The same process applies to any other .NET or .NET Core project.

Once installed, refer to the package in code with using <namespace> where <namespace> is specific to the package you're using. Once the reference is made, you can call the package through its API.

Tip

Start with nuget.org: Browsing nuget.org is how .NET developers typically find components they can reuse in their own applications. You can search nuget.org directly or find and install packages within Visual Studio as shown in this article. For general information, see Find and evaluate NuGet packages.

Prerequisites

Visual Studio Package Manager Console
  • Visual Studio 2019 with the .NET Desktop Development workload.

You can install the 2019 Community edition for free from visualstudio.com or use the Professional or Enterprise editions.

If you're using Visual Studio for Mac, see Install and use a package in Visual Studio for Mac.

Create a project

Visual studio package manager console install

NuGet packages can be installed into any .NET project, provided that the package supports the same target framework as the project.

For this walkthrough, use a simple WPF app. Create a project in Visual Studio using File > New Project, typing .NET in the search box, and then selecting the WPF App (.NET Framework). Click Next. Accept the default values for Framework when prompted.

Visual Studio creates the project, which opens in Solution Explorer.

Add the Newtonsoft.Json NuGet package

To install the package, you can use either the NuGet Package Manager or the Package Manager Console. When you install a package, NuGet records the dependency in either your project file or a packages.config file (depending on the project format). For more information, see Package consumption overview and workflow.

NuGet Package Manager

  1. In Solution Explorer, right-click References and choose Manage NuGet Packages.

  2. Choose 'nuget.org' as the Package source, select the Browse tab, search for Newtonsoft.Json, select that package in the list, and select Install:

    If you want more information on the NuGet Package Manager, see Install and manage packages using Visual Studio.

  3. Accept any license prompts.

  4. (Visual Studio 2017 only) If prompted to select a package management format, select PackageReference in project file:

  5. If prompted to review changes, select OK.

Package Manager Console

  1. Select the Tools > NuGet Package Manager > Package Manager Console menu command.

  2. Once the console opens, check that the Default project drop-down list shows the project into which you want to install the package. If you have a single project in the solution, it is already selected.

  3. Enter the command Install-Package Newtonsoft.Json (see Install-Package). The console window shows output for the command. Errors typically indicate that the package isn't compatible with the project's target framework.

    If you want more information on the Package Manager Console, see Install and manage packages using Package Manager Console.

Visual Studio Package Manager Console Initializing Powershell Host

Use the Newtonsoft.Json API in the app

Visual Studio 2017 Package Manager Console

With the Newtonsoft.Json package in the project, you can call its JsonConvert.SerializeObject method to convert an object to a human-readable string.

  1. Open MainWindow.xaml and replace the existing Grid element with the following:

  2. Open the MainWindow.xaml.cs file (located in Solution Explorer under the MainWindow.xaml node), and insert the following code inside the MainWindow class:

  3. Even though you added the Newtonsoft.Json package to the project, red squiggles appears under JsonConvert because you need a using statement at the top of the code file:

  4. Build and run the app by pressing F5 or selecting Debug > Start Debugging:

  5. Select on the button to see the contents of the TextBlock replaced with some JSON text:

Related video

Visual Studio Package Manager Console

Find more NuGet videos on Channel 9 and YouTube.

Next steps

Congratulations on installing and using your first NuGet package!

To explore more that NuGet has to offer, select the links below.

  1. Convert TXT to EMF via C++ application

    Try our On-Premise APIs for your document conversion using C++ Runtime Environment for Windows 32 bit, Windows 64 bit and Linux 64 bit....from NuGet × Open NuGet packagemanager, search for Aspose.Cells...the PackageManagerConsole. Copied! PM> Install-Package Aspose...

    products.aspose.com/cells/cpp/conversion/txt-to...
  2. Convert XLT to SVG via C++ application

    Try our On-Premise APIs for your document conversion using C++ Runtime Environment for Windows 32 bit, Windows 64 bit and Linux 64 bit....from NuGet × Open NuGet packagemanager, search for Aspose.Cells...the PackageManagerConsole. Copied! PM> Install-Package Aspose...

    products.aspose.com/cells/cpp/conversion/xlt-to...
  3. Convert XLTM to TIFF via C++ application

    Try our On-Premise APIs for your document conversion using C++ Runtime Environment for Windows 32 bit, Windows 64 bit and Linux 64 bit....from NuGet × Open NuGet packagemanager, search for Aspose.Cells...the PackageManagerConsole. Copied! PM> Install-Package Aspose...

    products.aspose.com/cells/cpp/conversion/xltm-t...
  4. Convert TXT to TIFF via C++ application

    Try our On-Premise APIs for your document conversion using C++ Runtime Environment for Windows 32 bit, Windows 64 bit and Linux 64 bit....from NuGet × Open NuGet packagemanager, search for Aspose.Cells...the PackageManagerConsole. Copied! PM> Install-Package Aspose...

    products.aspose.com/cells/cpp/conversion/txt-to...
  5. Convert XLT to PNG via C++ application

    Try our On-Premise APIs for your document conversion using C++ Runtime Environment for Windows 32 bit, Windows 64 bit and Linux 64 bit....from NuGet × Open NuGet packagemanager, search for Aspose.Cells...the PackageManagerConsole. Copied! PM> Install-Package Aspose...

    products.aspose.com/cells/cpp/conversion/xlt-to...
  6. Generate MAXICODE BarCode Images via .NET

    Try our On-Premise MAXICODE Barcode Image Generation API on .NET Framework, .NET Standard, COM Interloop for PHP, VBScript, Delphi, C++....from NuGet × Open NuGet packagemanager, search for Aspose.BarCode...the PackageManagerConsole. Copied! PM> Install-Package Aspose...

  7. Generate SSCC18 BarCode Images via .NET

    Try our On-Premise SSCC18 Barcode Image Generation API on .NET Framework, .NET Standard, COM Interloop for PHP, VBScript, Delphi, C++....from NuGet × Open NuGet packagemanager, search for Aspose.BarCode...the PackageManagerConsole. Copied! PM> Install-Package Aspose...

  8. Generate GS1DATAMATRIX BarCode Images via .NET

    Try our On-Premise GS1DATAMATRIX Barcode Image Generation API on .NET Framework, .NET Standard, COM Interloop for PHP, VBScript, Delphi, C++....from NuGet × Open NuGet packagemanager, search for Aspose.BarCode...the PackageManagerConsole. Copied! PM> Install-Package Aspose...

    products.aspose.com/barcode/net/generate/gs1dat...
  9. Generate UPCAGS1DATABARCOUPON BarCode Images vi...

    Try our On-Premise UPCAGS1DATABARCOUPON Barcode Image Generation API on .NET Framework, .NET Standard, COM Interloop for PHP, VBScript, Delphi, C++....from NuGet × Open NuGet packagemanager, search for Aspose.BarCode...the PackageManagerConsole. Copied! PM> Install-Package Aspose...

    products.aspose.com/barcode/net/generate/upcags...
  10. Generate PATCHCODE BarCode Images via .NET

    Try our On-Premise PATCHCODE Barcode Image Generation API on .NET Framework, .NET Standard, COM Interloop for PHP, VBScript, Delphi, C++....from NuGet × Open NuGet packagemanager, search for Aspose.BarCode...the PackageManagerConsole. Copied! PM> Install-Package Aspose...

    products.aspose.com/barcode/net/generate/patchcode