Setting up NuGet Server on Windows (Complete Walkthrough)

choubertsprojects

The Best WordPress plugins!

1. WP Reset

2. WP 301 Redirects

3. WP Force SSL

This article walks through setting up a NuGet server on Windows.

The “nuget server for powershell” is a tool that allows users to install, update and remove NuGet packages on Windows. This walkthrough will show you how to set up the server on Windows.

Setting up NuGet Server on Windows (Complete Walkthrough)

So you’ve written some code. Great! You must now make it available to your users. But how? There are a number of options, but NuGet is one of the most popular. NuGet is a tool that enables you to share code with others in the form of packages. A NuGet server is one method to do this.

NuGet has grown in popularity as a package manager, owing to its extensive use and integration with Microsoft’s development tools. Developers may utilize the NuGet packaging system to bundle code into packages that can subsequently be readily distributed to others.

NuGet is made up of two primary parts: a client and a server. A NuGet server maintains a repository, which is subsequently used to distribute packages. The NuGet client is a client-side component for creating and uploading local packages to server repositories. The packages are then downloaded through HTTP/HTTPS by various clients.

All of the other NuGet products you’ll learn about here are built on top of NuGet.Server. Before moving on to other options, you should first understand about NuGet.Server and how to set it up.

Setting up plain ol’ NuGet.Server with IIS will provide you with a wealth of information on how the other NuGet server products work.

Prerequisites

Before we go any further, there are a few things you’ll need to get started with NuGet. Setup of the server.

  • Visual Studio 2017 or later is recommended, while the Community Edition would suffice. This does not need to be installed on the server and may be done on a workstation.
  • Visual Studio’s ASP.NET and web development workload.
  • 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.

It’s worth noting that you don’t require NuGet.Server to get started. Because it will be loaded via the NuGet package management built into Visual Studio, there is no need to manually download it ahead of time.

Using Visual Studio to Create a Project

You must first create a project in Visual Studio before you can begin constructing a NuGet.Server. To do so, open Visual Studio and start a new project using the ASP.Web Application (Visual C#) template, as shown below.

Except for NuGet.Server, you may call the app anything you like. If you call your app NuGet.Server, you’ll have a name issue with the package you’ll download later, which may create problems down the line.

Using Visual Studio to create an ASP.NET Web ApplicationUsing Visual Studio to create an ASP.NET Web Application

After that, choose the blank template. This will construct an empty web app into which the NuGet.Server package will be installed. To do so, in the Solution Explorer, right-click on the project and choose NuGet Package Management, as shown below.

NuGet Package ManagementNuGet Package Management

Search for NuGet.Server in the pop-up box and pick the version you wish to install. Once you’ve made your choice, Visual Studio will begin downloading and installing the project’s dependencies.

After that, switch the project from Debug to Release to remove the debug logging from the final server.

Changing the status of the Visual Studio project to Changing the status of the Visual Studio project to “Release”

The project may then be built by going to the Build tab and choosing Build Solution.

The NuGet.Server project is being built.The NuGet.Server project is being built.

If you left the repo location as default, the application will be built at C:Users<username>sourcerepos<AppName><AppName>. The folder will look something like what is shown below. You will need this project folder to copy to your web server.

The NuGetServerApp project is located in the NuGetServerApp directory.The NuGetServerApp project is located in the NuGetServerApp directory.

If you’re not sure where your project folder is, you can always look it up in the project’s properties.

The location of the Visual Studio project folderThe location of the Visual Studio project folder

Setting up IIS

Install the Windows features NuGet package next. On the server, the server is required. Launch an administrator PowerShell session and execute the Install-WindowsFeature cmdlet with all of the required features as shown below to install all of the required roles on your server.

Install-WindowsFeature Web-Server, Web-ISAPI-Filter, Web-ISAPI-Ext -IncludeManagementTools, Web-Net-Ext45, Web-AspNet45, Web-ISAPI-Filter, Web-ISAPI-Ext -IncludeManagementTools

Once the IIS role and other features are installed, copy over the project folder (probably C:Users<username>sourcerepos<AppName><AppName>) to a directory on your web server. The default location for web apps is C:inetpubwwwroot. This is the directory I will be assuming your project is in.

Getting the Web Configuration Ready

The web.config is a configuration file. on the web server must then be examined. This file will be in the build folder you transferred to your web server’s root directory. Use your preferred text editor to open the web.config is a configuration file.. You’ll see two parallel lines that begin with the following:

<compilation debug=”true” targetFramework=”<version>” />

Take a look at the sample below.

web.config is a configuration file.web.config is a configuration file.

One of the compilation lines should be removed, and the one with the updated version should be kept.

When you start your website if you don’t do this, you’ll get an internal server error notice.

Setting up IIS

Open IIS manager, right-click on the default web site, and choose New Application as shown below.

Adding an Internet Information Services (IIS) applicationAdding an Internet Information Services (IIS) application

Give the application a unique name. Below is a sample of what you will be looking at.

Adding an Internet Information Services (IIS) applicationAdding an Internet Information Services (IIS) application

If you go to the URL of your web server now, you should see something like this.

Packages page for NuGet.ServerPackages page for NuGet.Server

Take note of the page’s package URI. It’s http://172.16.8.132/NuGet/nuget in the example above. This will come in handy later.

Changing the Packages Directory is a simple process.

By default, packages are stored in C:inetpubwwwroot<AppName>Packages. If you’d rather change that location, you can do so in the web.config is a configuration file..

You may also redirect the package folder to an other location. This may be useful if you have a tiny drive on which the web server files are stored, but a bigger disk on which the packages are stored. Alter the packagesPath variable in web.config to change the package path.

Once you are done making your changes to the web.config is a configuration file., restart the website to  load the new settings. To do this, from IIS Manager, right-click on the website and select Manage Website and then on Restart as shown below.

IIS restarting NuGet.ServerIIS restarting NuGet.Server

Using web.config to create an API Key

Take a look at the web.config is a configuration file. snippet below. By default, the API key is blank. That’s a problem.

API key in web.config is a configuration file.API key in web.config is a configuration file.

You may enter an API key here if you want to password-protect your NuGet packages. When you create an API key, you’ll have to use it every time you want to add or remove packages from the repository.

Save the file after adding the key to the apiKey value. To avoid needing an API key to add or remove packages, set the value for requireApiKey to false.

NuGet.Server is being updated.

You now have your NuGet package. What happens now that the server is up and running? NuGet. Server is a Nuget package management that receives regular updates, which you should take advantage of.

Open your prior project to update a NuGet.Server. This is the same path that you found before where your project is being created. It may also be included in your recent projects if you launch Visual Studio.

Once it is opened right-click on the project in the Solution Explorer and select NuGet Package Management. From here you can see all the packages that have updates. Select NuGet.Server and click update as shown below.

NuGet.Server is being updated. in Visual StudioNuGet.Server is being updated. in Visual Studio

This will bring NuGet.Server and all of its dependencies up to date. It’s that simple!

Steps to Follow

At this point, your system should have a fresh new NuGet.Server instance running. You should be proud of yourself for putting it together. However, this is just the first step.

Continue your trip by looking at all of the other NuGet articles on ATA!

The “nuget.server .net core” is a command-line tool that allows users to set up NuGet Server on Windows. This article will walk you through the process of setting up NuGet Server on Windows and configuring it to work with ASPNET Core 2.0.

Frequently Asked Questions

Related Tags

  • nuget server linux
  • private nuget server
  • nuget server web config
  • self hosted nuget server
  • simple nuget server

Table of Content