How To Create Remote NuGet Feed

In my previous post, we discussed about how to create a NuGet Package. In this article, we will talk about how to create a remote feed for NuGet packages. So let`s get started.

Steps:

  1. To get started, open visual studio and select File, New, then Project option which will open up a new Project dialog box as shown below:

    New Project Dialog box In Visual Studio 2013
                               Figure 1: New Project Dialog box In Visual Studio 2013 

    Select ASP.NET Web Application Project option, enter the name of the project as RemoteNugetFeed and then click on OK button.

  2. After clicking on OK button, Project Template window will pop up as in the following screenshot:

    Project Template Dialog box
                                                   Figure 2: Project Template Dialog box 

    Select the Empty option and click on OK button. After clicking on OK button, empty ASP.NET web application will get created.

  3. Once the project is fully loaded in Visual Studio, click on References and select Manage NuGet Packages option. It will open up Package Manager Window. Select the Online tab and search for NuGet.Server package as in the following:

    Install NuGet.Server package
                                          Figure 3: Install NuGet.Server package

    Click on the Install button to install the package. NuGet.Server package will convert our empty website into a site that is ready to serve the OData package feed.

  4. Now we just need to add our package to the Packages folder in our project. I have added my package to the Packages folder as in the following:

    Add Packages To Package Folder
             Figure 4: Add Packages To Package Folder

  5. Now let`s run the application. After running the application, we will get a page as in the following that contain some instruction on what to do next:

    Remote NuGet Feed Website
                            Figure 5: Remote NuGet Feed Website

  6. Let`s click on “here" to see the OData over ATOM feed of packages:

    XML
                                        Figure 6: OData over ATOM feed of packages

  7. Now we are all set to deploy this website as any other website. I have deployed this application here. To add our remote feed as a package source in Visual Studio, go to Tools, then Option menu. It will open up a window and search for package source. Then click on plus icon to add package source as in the following (I have given the new package source name as RemoteFeed):

    Add Remote Feed As A Package Source In Visual Studio
                         Figure 7: Add Remote Feed As A Package Source In Visual Studio

    Note: Here's the URL for package source is. After adding our new remote feed as a package source, we can now install the packages from our remote feed in any project:

    Remote NuGet Feed
                                                       Figure 8: Remote NuGet Feed


Conclusion

In this article, we learned about how to create a remote NuGet feed. I hope you enjoyed reading the article.
Happy coding!

X

Build smarter apps with Machine Learning, Bots, Cognitive Services - Start free.

Start Learning Now