Microsoft provides NuGet.Server package that can host a package feed on any server that runs IIS using ASP.NET application.
- NuGet.Server makes a folder on the server available through HTTP(S) specifically OData.
- It is easy to set up and is best for simple scenarios.
Create ASP.NET Application
The first step is to create an empty ASP.NET Web application in Visual Studio.
Select the ASP.NET Web Application (.NET Framework) and enter the name for your server in the Name field and then select OK.
Select the Empty template, then click OK. Now add the NuGet.Server package to your project using NuGet Package Manager.
It converts the empty Web application into a package source.
- It installs a variety of other packages, creates a Packages folder in the application, and modifies web.config to include additional settings.
- You can change the packages folder in web.config file by specifying the value of
Web.config and set the value of
packagesPath to D:\MyPackages.
Run your application, and you will have a NuGet Server.
- The home page provides the package feed URLs.
- If you see errors, carefully inspect your
web.configfor duplicate elements.
- Click on
heresee the OData feed of packages.
Add Packages to the Feed
Once a NuGet.Server site is running; you can add packages using
nuget push provided that you set an API key value in web.config.
- After installing the
web.configcontains an empty
apiKeyis blank, pushing packages to the feed is disabled.
To enable this capability, set the
apiKey to a value (strong password) and add a key called
appSettings/requireApiKey with the value of
If your server is already secured or you do not require an API key, you can set
false. All users with access to the server can then push packages.
Removing Packages from the Feed
You can remove a package using
nuget delete command from the repository provided that you include the API key with the comment.
If you want to change the behavior to delist the package instead and leaving it available for package restore, change the
enableDelisting key in
web.config to true.