Skip to main content

Hosting your own NuGet feeds

There are multiple ways to host your own NuGet feeds:

  • Using a fileshare
  • Using MyGet
  • Using the NuGet server package
  • Using the NuGet Gallery  code
Hosting your NuGet feeds using a fileshare

This is probably the easiest solution. Just create fileshare on a server somewhere and put all your packages on this share. This approach has one big disadvantage, it becomes rather slow when the number of packages grows.

Hosting your NuGet feeds on MyGet

image

MyGet, also known as ‘NuGet as a Service’ allows you to create and host your own NuGet feed. It allows you to include packages from the official NuGet feed or upload your own NuGet packages. It offers lots of nice features and best of all if you don’t need private feeds, it’s free!

Hosting your NuGet feeds using the NuGet server package

This option needs a little bit more work.

  1. Create an empty ASP.NET MVC(or WebForms) project.
  2. Download the NuGet.Server package from the official NuGet feed. This will create a simple oData feed.
  3. Deploy the application to a webserver of your choice.
  4. Add or remove packages by putting them in the Packages folder that is created for you.

Big advantage of this approach is that it introduces some caching improving the performance of the NuGet feeds.

Hosting your NuGet feeds using the NuGet Gallery

image

The last option but also the most complex one is to use the NuGet gallery, the same code that the NuGet team is using to host NuGet.org. Unfortunately you’ll have some work to get everything up and running:

  1. Download the latest source from GitHub.
  2. Navigate to the Website subdirectory and open the web.config. Inside the web.config change the following options:
    1. Modify the configuration/connectionStrings/NuGetGallery key so it points to your locally hosted SQL Server.
    2. Change the appSettings/GalleryOwnerEmail to the email address of the person who is going to administer the site.
    3. Change the appSettings/Configuration:SiteRoot to reflect the domain name you are going to use for the site.
  3. Run the Build-Solution.ps1 script using Powershell in the root directory. This will compile the website and assemble the binaries.
  4. Open up your IIS Manager
    1. Create a new application pool. The pool should use the 4.0 framework and use an integrated pipeline.
    2. Create a new website. Set the site’s physical path to point at the Website directory. Also make sure the site uses the application pool that you created in the previous step. Do not start the website yet.
  5. Open up SQL Server Management Studio
    1. Grant db_creator to the identity of the application pool you created earlier. The account needs db_creator because the first time you run the application, the Entity Framework context initializer will run. If no database exists yet then it will create the database for you. After the database is created, you can trim back the permissions to db_datareader and db_datawriter.
  6. Navigate to the NuGet gallery website. It may take a second or two for the page to appear because the database gets created during the first run.

Popular posts from this blog

Azure DevOps/ GitHub emoji

I’m really bad at remembering emoji’s. So here is cheat sheet with all emoji’s that can be used in tools that support the github emoji markdown markup: All credits go to rcaviers who created this list.

Kubernetes–Limit your environmental impact

Reducing the carbon footprint and CO2 emission of our (cloud) workloads, is a responsibility of all of us. If you are running a Kubernetes cluster, have a look at Kube-Green . kube-green is a simple Kubernetes operator that automatically shuts down (some of) your pods when you don't need them. A single pod produces about 11 Kg CO2eq per year( here the calculation). Reason enough to give it a try! Installing kube-green in your cluster The easiest way to install the operator in your cluster is through kubectl. We first need to install a cert-manager: kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.14.5/cert-manager.yaml Remark: Wait a minute before you continue as it can take some time before the cert-manager is up & running inside your cluster. Now we can install the kube-green operator: kubectl apply -f https://github.com/kube-green/kube-green/releases/latest/download/kube-green.yaml Now in the namespace where we want t...

DevToys–A swiss army knife for developers

As a developer there are a lot of small tasks you need to do as part of your coding, debugging and testing activities.  DevToys is an offline windows app that tries to help you with these tasks. Instead of using different websites you get a fully offline experience offering help for a large list of tasks. Many tools are available. Here is the current list: Converters JSON <> YAML Timestamp Number Base Cron Parser Encoders / Decoders HTML URL Base64 Text & Image GZip JWT Decoder Formatters JSON SQL XML Generators Hash (MD5, SHA1, SHA256, SHA512) UUID 1 and 4 Lorem Ipsum Checksum Text Escape / Unescape Inspector & Case Converter Regex Tester Text Comparer XML Validator Markdown Preview Graphic Col...