Skip to content
This repository has been archived by the owner on Jan 16, 2024. It is now read-only.

mavnn/NuGetPlus

Repository files navigation

Version 3.2 release

Please check the release notes

Repeatable NuGet actions

This project aims to provide a NuGet wrapper with the following functionality, both via dll and via an easy to use command line interface:

  1. Reliable installation of NuGet references to C#, VB.net and F# projects.
  2. Reliable upgrades of NuGet references in all project types.
  3. Reliable downgrades of NuGet references in all project types. It’s painful to try a new release/pre-release of a NuGet package across a solution and then discover that you have to manually downgrade all of the projects separately if you decide not to take the new version.
  4. Reliable removal of NuGet references turns out to be a requirement of reliable downgrades.
  5. Sane solution wide management of references. Due to the way project references work, we need an easy way to ensure that all of the projects in a solution use the same version of any particular NuGet reference, and to check that this will not case any version conflicts. So ideally, upgrade and downgrade commands will run against a solution.

As a 'meta-goal' we aim to be a dropin replacement, respecting things like nuget.config files in the same way as the official NuGet clients (with an exception for where those clients are subject to bugs).

At this time, goals 1-4 are officially supported. 5 only supports solution wide restore at this point, which it does in an efficient manner.

There is a blog post that contains more explaination on the project aims.

Command line options available for ngp.exe

--action <string>: Specify an action: Scan, Install, Remove, Restore, Update, SolutionRestore or SolutionUpdate
--file <string>: Path to project or solution file to update.
--packageid <string>: NuGet package id for action.
--version <string>: Optional specific version of package.

Scan lists any packages in a solution where more than one version is installed.

Call the same logic easily from code

ngp.exe is a thin wrapper around the underlying dll, allowing the same operations to be called:

Methods available in ProjectManagement are:

// This is F# code but the dll can be referenced from other .net languages too.
let packageName = "myPackage"
let packageVersion = NuGet.SemanticVersion("10.0.2.0")
let projectName = "myProject.fs"

open NuGetPlus.ProjectManagement

InstallReference projectName packageName
InstallReferenceOfSpecificVersion projectName packageName packageVersion
UpdateReference projectName packageName
UpdateReferenceToSpecificVersion projectName packageName packageVersion
RemoveReference projectName packageName
RestoreReferences projectName

Methods available in SolutionManagement are:

// This is F# code but the dll can be referenced from other .net languages too.
let solutionName = "mySolution.fs"
let packageName = "myPackage"
let packageVersion = NuGet.SemanticVersion("10.0.2.0")

open NuGetPlus.SolutionManagement

RestorePackages solutionName
Scan solutionName
UpdateReference solutionName packageName
UpdateReferenceToSpecificVersion solutionName packageName packageVersion
(* This may update dependencies to version you were not expecting -
use with caution! *)

Depending on the number of projects in your solution, this can be significantly faster (an order of magnitude or more) than restoring each packages.config in turn.

Get involved!

Issues and the current roadmap can be found at the NuGetPlus YouTrack Instance.

Pull requests gratefully accepted. The code was hacked together in a hurry as I learnt how NuGet had been built, so it could definitely be cleaned up.

Continuous Integration and Issue Management provided by CodeBetter and JetBrains

NuGetPlus TeamCity Project is kindly provided by CodeBetter and JetBrains.

NuGetPlus YouTrack Instance provided by JetBrains under their OSS Project License.

Many thanks to both CodeBetter and JetBrains for provided these services.

YouTrack and TeamCity