How to Set Up All the NuGet Package Managers [In Depth]

choubertsprojects

VPN offers!

1. NordVPN

2. Surfshark

3. ExpressVPN

Setting up all the NuGet package managers can be a tedious and time-consuming process, but it is important to do so. Learn how to set up your environment with these tools properly in this guide. You’ll save yourself headaches later on down the road!

NuGet is a package manager that allows users to download and install packages of libraries, tools, frameworks, and other assets. You can use the NuGet Package Manager in Visual Studio 2019 to manage your installed packages. This article will cover how to set up all the NuGet Package Managers for Visual Studio 2019.

How to Set Up All the NuGet Package Managers [In Depth]

You’ve created an application, or possibly a series of critical scripts, and now you need to bundle and deploy it. NuGet and the numerous NuGet package managers are a great place to start.

You’ll learn how to set up several NuGet package managers for the first time in this post so you can start utilizing them right away.

Setting up NuGet Server on Windows is a related topic (Complete Walkthrough)

Configuring the NuGet.Server Wrapper

While creating a NuGet.Server from the ground up is not difficult, it might take some time for someone who is unfamiliar with Visual Studio and IIS. A wrapper is a means to speed up the setup and updating process. Nuget-server, built by svenkle and available on their Github website, is one of the most used wrappers.

IIS Express is one of the biggest distinctions between utilizing this wrapper and manually installing the web server. On Microsoft’s website, you can learn more about the changes.

The following are two significant differences between using a vanilla NuGet.Server and using this wrapper:

  • To start the web server, you must first establish a Windows service.
  • The IIS Manager cannot be used for configuration.

The main disadvantage of installing NuGet.Server with a wrapper is that you can’t simply change the version until the wrapper is updated.

Prerequisites

If you want to learn how to set up this NuGet.Server wrapper, make sure you have the following items:

The Web Server Service is installed.

Creating a new Windows service is the first step. You can’t piggyback on IIS with this NuGet.Server wrapper since it doesn’t utilize it.

Unzip the NuGetServer.zip file you got from the releases page to your web server’s preferred location. Create a Windows service to automatically launch the web page when the server is started after it has been unzipped. A PowerShell command to do this is shown below.

New-Service -Name NuGetServer -BinaryPathName ‘<UnzipPath>Svenkle.NuGetServer.Service.exe’ -StartupType Automatic Start-Service -Name NuGetServer

Web Server Personalization

It’s time to configure the web.config file now that you’ve installed NuGet.Server from the wrapper and the service has been built and started. If you want, you may use the manual deployment to apply the identical modifications to the web.config file.

The web.config file is located in the <UnzipPath>HostWebsite folder. The major difference with this deployment is it uses port 8080 instead of the default HTTP port 80. This means that anywhere where you would have used the web URL, you have to append :8080, such as when going to the web page it would be http://localhost:8080/nuget.

Everything has been completed. That was a lot more straightforward than using Visual Studio!

Installing BaGet on IIS

While you’ve just looked at stock versions of NuGet.Server so far, there are a variety of alternative versions available. An open-source project named BaGet is a popular NuGet package manager.

Let’s have a look at how to install and operate BaGet on a Windows Server using IIS.

Prerequisites

Before you begin, make sure you satisfy a few requirements.

  • BaGet.zip is a file that contains everything you need to get started. The project is still in pre-release at the time of writing, and I’m running version 0.1.77.
  • .NET Core Runtime & Hosting Bundle – This will need to be downloaded and available on the web server for later.
  • Windows Server — Any version of Windows Server that is presently supported will work, although all of the screenshots were taken on Windows Server 2019 Standard.

Prerequisites for Installing a Web Server

These instructions will be used to install BaGet on a Windows server and may be run on Linux with.NET Core or in a Docker image. You may use IIS to start and stop your server in this manner.

IIS should be installed.

Because BaGet is based on.NET Core, it has less Prerequisites than the standard NuGet.Server for which you previously installed IIS. Only the default IIS web server and the IIS manager are required. Open a PowerShell session on your web server and perform the following commands:

-IncludeManagementTools -Install-WindowsFeatureWeb-Server

.NET Core must be installed.

Then, on the web server, install the.NET Core package. Run the exe file you downloaded previously to do this. For this installation, you may keep all of the choices at their default settings.

After IIS is installed, you must install the.NET Core package. If this does not happen in the right sequence, you will need to repeat the.NET Core bundle installer and choose repair to add the missing web app needs.

Unzip the BaGet.zip file you obtained previously and put it in the C:inetpubwwwroot folder on your web server now that you have the web server components ready.

The Web Server Application’s Configuration

To get NuGet package manager BaGet up and going, you’ll need to put up a few IIS components, similar to NuGet.Server.

The BaGet IIS Application Pool is created.

Go to Application Pools in IIS Manager on the web server. Because BaGet will not be using.NET managed code, create a separate application pool for it. You may call it anything you like. This is how it should seem.

Creating a pool of BaGet applicationsCreating a pool of BaGet applications

The BaGet Website was built from the ground up.

Create the website when the application pool has been built. It’s simplest to construct a distinct website from the Default Web Site since BeGet utilizes a non-standard HTTP port and non-default app pool. To do so, in IIS manager, right-click on the Sites folder and choose Add Website.

The options you’ll need to setup BaGet are listed below.

Creating an IIS Website using BaGetCreating an IIS Website using BaGet

The site should start immediately after you’ve setup it. Go to http://localhost:5000/ from your server to have a look at it.

Web website for BaGet bundlesWeb website for BaGet bundles

When compared to the conventional NuGet.Server website, the BaGet webpage has a more user-friendly UI. Instead of utilizing the NuGet command-line options, BaGet allows you to simply search for packages that have been uploaded and gives instructions on how to upload in a number of methods.

BaGet Web Server Customization

Remember how you used the web.config file to configure your NuGet.Server server? The web.config file, however, is not used by the NuGet package management BaGet. Instead, since BaGet can be used on Linux, the developers created a JSON file named appsettings.json to provide a more cross-platform structure. It’s in the C:inetpubwwwrootBaGet directory.

All paths in BaGet utilize forward slashes since it uses.NET Core for cross-platform capability.

For example, if you wanted your package path to be stored at C:Packages on your server, you’d need to include the following in your appsettings.json file.

“Storage”: “Type”: “FileSystem”, “Path”: “C:/Packages” “Storage”: “Type”: “FileSystem”, “Path”: “C:/Packages”

API Key for BaGet

You’ll still need to create an API key to safeguard your NuGet server from unauthorized users publishing or removing packages. The API key is also configured in the appsettings.json file, so you may do so while you’re there.

I can register a PSRepository once again since I’m using PowerShell to handle my NuGet packages. Navigate to the website you built for BaGet. The command to execute in your PowerShell session may be found on the website. Consider the following scenario:

Register-PSRepository -Name “BaGet” -SourceLocation “http://<WebServer>:5000/v3/index.json” -PublishLocation “http://<WebServer>:5000/api/v2/package” -InstallationPolicy “Trusted”

BaGet Forks: What You Need to Know (LiGet)

While BaGet has a lot of choices for usage, there are various forks of BaGet that specialize on certain aspects of NuGet. LiGet is one of the most popular forks. LiGet is unique in that it focuses on the Linux operating system.

LiGet is a fork of BaGet’s original NuGet package management project. The developers did this for a variety of reasons, but the primary one was to concentrate on certain particular NuGet features, such as v3 feed support. The use case using PowerShell is unaffected by V3 feed support. However, if you’re planning to run a NuGet server for other purposes, you may appreciate the extra features.

The Hashed API Key for LiGet

The usage of a hashed API key rather than Text in Plain Language is a significant distinction between LiGet and BaGet. Someone with access to the web.config file on NuGet.Server or the appsettings.json on BaGet might publish to the server using a Text in Plain Language key. This would not be possible with LiGet.

To get LiGet up and running, you’ll need to generate a hashed API key and save it to the C:inetpubwwwrootLiGet folder’s appsettings.json file.

You may use PowerShell or any other hashing technique you’re familiar with to build the hash. Here’s an example of what you’d do to produce a hash on your computer.

([System.Security.Cryptography.HashAlgorithm]::Create(‘SHA256’).ComputeHash([System.Text.Encoding]::UTF8.GetBytes(<apikey>)) | Foreach-Object { $_.ToString(‘x2’)}) -join ”

You may also generate the hash using an online hash generator.

The disadvantage of this method is that if you forget the API key, you’ll have to construct a new hash and replace it since the hash is not reversible.

How to Setup ProGet on IIS

All of the alternatives discussed thus far are free and have few moving parts once they are set up. While this is a fantastic way to get started with NuGet, if you want to interface with other tools or need vendor support for a system at work, the NuGet package manager ProGet may be a better alternative.

Prerequisites

To set up ProGet, you’ll need a few standard prereqs that you’re presumably already familiar with, plus an optional SQL database.

  • Windows Server — Any version of Windows Server that is presently supported will work, although all of the screenshots were taken on Windows Server 2019 Standard.
  • ProGet Installer — I’m using version 5.2.9 of ProGet.
  • SQL Instance – This is unnecessary since ProGet includes an option to install SQL Express via the installer, albeit this does need your server to have an internet connection to conduct the initial download.

How to Setup ProGet

From your web server run the ProGet installer. Since you’re setting up IIS, select the IIS web server option when How to Setup ProGet. If you do not already have IIS installed, it will handle the installation during the install of ProGet.

Unless you wish to host the ProGet database on a different SQL server, you may leave the rest of the choices alone. You’ll need to provide the SQL instance to utilize in that situation.

If you choose Install Inedo instance as the SQL Server option, SQL Express server will be installed for you.

How to Setup ProGetHow to Setup ProGet

When the installation is complete, open the website as instructed, and you should see a page similar to the one shown below.

ProReturn to your homeProReturn to your home

Using ProGet to set up a PSRepository

ProGet has now been installed. It’s rather simple. We’ll need to set up a PSRepository since we’ll be utilizing PowerShell to deal with NuGet packages, like we did before.

Create a new feed in the Feeds tab of ProGet to set it up for a PSRepository. You may call the stream anything you like. Then, as seen below, choose Third-party package format and PowerShell.

Creating a PSRepository feed with ProGetCreating a PSRepository feed with ProGet

Return to the Feeds tab after creating the feed, pick your new feed, and it will provide the URL for posting. To publish to or download from this PSRepository, you’ll need to execute this in PowerShell on a device.

The following is what was shown in the preceding example:

Register-PSRepository -Name ProGet -SourceLocation http://<WebServer>:8624/nuget/PSRepository/ -PublishLocation http://<WebServer>:8624/nuget/PSRepository/ -InstallationPolicy Trusted

How to Add an API Key

You’ll need to create an API key, just like the other alternatives. To do so, go to the top right corner and click the gear icon, then pick API Keys from the left toolbar. Existing API keys may be seen here, and new ones can be created. You’ll notice a significant difference between the open-source and corporate versions of ProGet right away. You may have many API keys with ProGet.

API Keys for ProGetAPI Keys for ProGet

Click Create API Key on the API Keys screen. Select Feed API from the drop-down menu and click Save API Key.

How to Make a ProGet API KeyHow to Make a ProGet API Key

It will send you back to the API keys page after the API key has been generated. You may use the API key you see to publish packages to your feed from here.

Using ProGet to Find Packages

From the Packages page, you can search all NuGet packages in the feed, check their download count, the names of the PowerShell modules, which feed a package was uploaded into, and other similar package metrics, as shown below.

In ProGet, you can see NuGet packages.In ProGet, you can see NuGet packages.

You may also go to the Feeds page and choose a feed to view just the packages associated with that feed. As demonstrated below, you can dig down to specific packages to get numbers and other statistics about them.

Individual ProGet bundles may be seen.Individual ProGet bundles may be seen.

ProGet is being updated.

One of the nice parts about using a product that has positioned for an enterprise is that some of the more time-consuming administrative tasks are much faster. An example of this is ProGet is being updated..

Simply run the Inedo Installer on your web server to upgrade ProGet to the latest version. When you originally installed ProGet, this was already installed. Simply click the Upgrade button as shown below, and the installer will take care of the rest.

ProGet is being updated.ProGet is being updated.

In this post, you’ve learnt a lot about NuGet tools. If you’re still undecided about which one to try, this section will give you an idea of what makes each one unique.

Choosing between BaGet and LiGet is a difficult task.

Because LiGet is a branch of BaGet, there are a lot of similarities between the two, including the majority of the setup procedure. You can, in fact, use the identical setup technique as BaGet.

LiGet and BaGet share several functionality once installed, but they vary in other aspects.

Feature BaGet LiGet
Web Port 5000 9011
URL of the source /v3/index.json /api/v3/index.json
API for searching NuGet packages v2 v3
API Key Text in Plain Language SHA256 is a hash algorithm.
Web-based user interface You may view a list of packages and upload commands. No Web-based user interface

While most of these modifications have little bearing on PowerShell usage, utilizing a hashed API key changes the configuration significantly.

Both BaGet and LiGet are written in.NET Core, making them cross-platform and Linux compatible. in addition to Windows Both provide Docker images, which may make the setup considerably quicker and portable if you’re already utilizing a container service.

With just a few minor variations between LiGet and BaGet, either one is a superb open-source, container-friendly NuGet server alternative. Both methods enable you to get your feet wet with a NuGet server on Windows while also letting you to easily migrate to Linux or a Docker image in the future.

ProGet vs. BaGet

There’s always ProGet if you’d rather not roll your own to some extent and take the easy way out. However, there are drawbacks. ProGet is not open source nor free in any way. However, it is simpler to set up and use.

Between ProGet and BaGet, there are a few significant distinctions.

Feature ProGet BaGet
Cost ProGet Free is free, ProGet Basic is $1995 per year, and ProGet Enterprise is $9995 per year or more. Free
Platform Windows Windows, Linux, and Docker are all options.
Database SQL Internal
Support ProGet Basic and Enterprise: Defined SLAs with Email, Slack, and Phone support, ProGet Free: Email and Slack support, ProGet Basic and Enterprise: Defined SLAs with Email, Slack, and Phone support GitHub problems are used to build a community.

Inedo also provides a list of all the features that change across ProGet versions.

Summary

You learnt a lot about NuGet tools and technologies in this article. If you were undecided about which NuGet server to use, you should now have a lot more information to assist you decide.

You learnt how to set up each NuGet tool to operate with Windows and we went through many of its capabilities.

NuGet is a package manager that allows users to install and manage nuget packages. It has been used by developers for many years, but new users may have some trouble getting started with it. In this blog post I will go over how to set up all the NuGet package managers in detail. Reference: manage nuget packages greyed out.

Frequently Asked Questions

Related Tags

  • nuget package explorer
  • how to add nuget package source in visual studio 2019
  • nuget package source url visual studio 2019
  • update nuget package manager visual studio 2019
  • manage nuget packages not showing