notes from a passionate developer

Developer that lives by the mantra "code is meant to be shared".




This is a personal blog. The opinions expressed here represent my own and not those of my employer, nor current or previous. All content is published "as is", without warranty of any kind and I don't take any responsibility and can't be liable for any claims, damages or other liabilities that might be caused by the content.

Just put together LightNuGetServer

Daniel WertheimDaniel Wertheim

I was in the need of hosting an on premise NuGet server. I didn't want it hosted in IIS but self-hosted. Previously I've had good experience with ProGet so my first take was to try their free version. I had a minor issue with Windows Defender complaining during the install. Apparently that is a known issue with some AV tools: "Anti-malware False Positives, Code Signing, and Safety of Inedo Products". ProGet would definitely have worked. But I didn't need all features. So I continued and looked at the options on this list and my second option was to look at putting together something using the NuGet.Server. It's well documented: here and at Scott Hanselman's blog. How-ever, I did miss two things:

I wanted it self-hosted in a service and I wanted support for multiple feeds with different API-keys

And voilĂ , the result became: LightNuGetServer. It will solve my needs and it will be adequate for my current use-case. If not, I can always switch later. It uses Topshelf and NuGet.Server and you configure it in a JSON-file. You could e.g. put up two feeds, with configuration like this:

  "packagesDirPath": "Packages",
  "feeds": [
      "name": "Default", //gives feed "/default"
      "apiKey": "foobar",
      "requiresApiKey": true,
      "nuGetServerSettings": {
        "allowOverrideExistingPackageOnPush": false,
        "ignoreSymbolsPackages": false,
        "enableDelisting": false,
        "enableFrameworkFiltering": false,
        "enableFileSystemMonitoring": true
      "name": "Some Weird Name", //gives feed "/some-weird-name"
      "requiresApiKey": false,
      "nuGetServerSettings": {
        "ignoreSymbolsPackages": true


By default it's configured to use the NETWORK SERVICE account. In case you want to override things, see switches for the install command.

The port is controlled in the App.config

LightNuGetServer.exe --install  

Depending on use-case, you might need to open the port for inbound traffic in the firewall. Also. You will have to take care of TLS etc. For me, it will run behind a reverse proxy with SSL offloading.

If you need to add an URL-ACL, it would look like this:

netsh http add urlacl  
  url=http://+:5000/ user="NT AUTHORITY\NETWORK SERVICE"

Use it

And start using it. E.g. the Default feed configured:

nuget push .\Topshelf.4.0.3.nupkg  
  -source http://localhost:5000/default
  -apikey foobar

nuget delete Topshelf 4.0.3  
  -source http://localhost:5000/defualt
  -apikey foobar

Or the unsecured feed Some Weird Name:

nuget push .\Topshelf.4.0.3.nupkg  
  -source http://localhost:5000/nuget/some-weird-name

nuget delete Topshelf 4.0.3  
  -source http://localhost:5000/nuget/some-weird-name

Basically, you just activate it using OWIN:

var settings = LightNugetServerSettingsJsonFactory.Create(  
var config = new HttpConfiguration();

app.UseLightNuGetServer(config, settings, feeds =>  
  //I didn't want to bring in a IoC framewor
  //but you can solve this another way
    new LightNuGetFeedControllerActivator(feeds));

Use it if you want. The code is on GitHub.



Developer that lives by the mantra "code is meant to be shared".