Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a nuget.exe command-line equivalent of Uninstall-Package?

I'm working on a NuGet package that installs a bunch of content - views, scripts, CSS files - into a web application, and trying to improve the change-compile-test cycle. I have two projects - the framework itself ("Package") and the demo web app that consumes it ("Website")

What I need to do as part of the Visual Studio build process is:

  1. (as part of Package post-build) Nuget pack Package.nuspec -OutputDirectory ..\pkg\
  2. (as part of Website pre-build) Nuget uninstall Package
  3. (as part of Website pre-build) Nuget install package -source ..\pkg\

The problem is - there doesn't seem to be any command-line equivalent of doing Uninstall-Package from the NuGet Package Manager console. Am I missing something?

like image 785
Dylan Beattie Avatar asked Oct 30 '13 17:10

Dylan Beattie


People also ask

How do I uninstall NuGet from command line?

Right-click on Project and select Manage NuGet Packages option. Select the Installed tab from NuGet Package Manager dialog and you can see the installed Syncfusion NuGet packages list by giving the Syncfusion keyword in search. Uninstall the Syncfusion NuGet packages which are not required for the project.

How do you delete a NuGet package?

Starting in Visual Studio 2017, use the Tools > NuGet Package Manager > Package Manager Settings menu command, then select Clear All NuGet Cache(s).


2 Answers

No there isn't currently.

Also, nuget.exe install doesn't really install anything. What nuget.exe install really does is nuget.exe restore: it restores the extracted package in the output directory. It doesn't run the PowerShell hooks (e.g. install.ps1) and it doesn't modify any target project (as there's none being targeted).

like image 85
Xavier Decoster Avatar answered Oct 10 '22 14:10

Xavier Decoster


There is a way but using neither Visual Studio nor NuGet.exe. Using a custom build of SharpDevelop you can install and uninstall NuGet packages from the command line and have their PowerShell scripts run.

This custom build of SharpDevelop and its NuGet addin allows you to run the commands, such as Install-Package and Uninstall-Package, from PowerShell but outside of Visual Studio.

The limitations are that it needs SharpDevelop to be available and it also does not support any PowerShell scripts that are Visual Studio specific.

like image 44
Matt Ward Avatar answered Oct 10 '22 14:10

Matt Ward