Restoring NuGet packages for .NET projects in Strider

Since getting .NET projects building in strider was pretty easy, I decided to add built-in NuGet package installation. That way, you don't need to store nuget.exe for every single project you create (NuGet package restore).

Thankfully, hosts the latest version of nuget.exe at This makes it extremely easy to pull down the latest version. I used request to pull it down, as it is easy to download a file:


I decided to store nuget.exe in strider's base directory (c:\.strider on my dev box), as strider is guaranteed to be able to write there. It is pretty easy to get inside a runner context:

var nugetPath = path.join(context.baseDir, 'nuget', 'nuget.exe');  

I then used fs-extra to make sure the full path to the file exists for writing, and then download it:

fs.ensureFile(nugetPath, function() {  
  var file = fs.createWriteStream(nugetPath);

I also decided to ensure that the latest version of nuget is installed (if nuget.exe already exists):

fs.exists(nugetPath, function(exists) {  
  if (exists) {
    childProc.spawn(nugetPath, [ 'update', '-Self' ]);
  } else { // download it... see above }

In order to get the packages, I just had to call nuget restore:

  cmd: {
    command: nugetPath,
    args: ['restore', '-NonInteractive' ],
    screen: 'nuget restore'
}, done);

In all these code snippets, I removed all the extraneous logging information. But, in the actual repo, there is a lot of code to give more feedback when building in strider. You can check it out on github.


View or Post Comments