Home: Add "force" option to `nuget add`?

Created on 17 Mar 2016  路  5Comments  路  Source: NuGet/Home

When adding a package to a local repository, it'd be helpful to have a "force" option so that NuGet will overwrite an existing package/version instead of telling me that the package already exists. Currently, if I try to re-publish a package (say I'm just testing my publish script, for instance, and don't want to keep incrementing the version), I get this message:

Package 'X.Y.Z.1.0.0' already exists at feed '\MyServer\NuGet'.

NuGet.exe DCR

Most helpful comment

Um, here's some feedback to support this: please?

The issue description and prescribed solution are pretty straightforward, but if an example is needed:

nuget add "ExistingPackage.1.2.3" -Source "C:\NuGet\Packages" -Force
> Overwriting existing package 'ExistingPackage.1.2.3' at feed 'C:\NuGet\Packages'.

Instead of:

nuget add "ExistingPackage.1.2.3" -Source "C:\NuGet\Packages"
> Package 'ExistingPackage.1.2.3' already exists at feed 'C:\NuGet\Packages'.

All 5 comments

Closing due to lack of feedback supporting this.

Um, here's some feedback to support this: please?

The issue description and prescribed solution are pretty straightforward, but if an example is needed:

nuget add "ExistingPackage.1.2.3" -Source "C:\NuGet\Packages" -Force
> Overwriting existing package 'ExistingPackage.1.2.3' at feed 'C:\NuGet\Packages'.

Instead of:

nuget add "ExistingPackage.1.2.3" -Source "C:\NuGet\Packages"
> Package 'ExistingPackage.1.2.3' already exists at feed 'C:\NuGet\Packages'.

I have another common scenario where this is quite useful. I have a release script which builds and uploads a package to a feed and uploads the symbols package to a local source server. If the source server fails to accept the symbols package for whatever reason and I run my release script again, the symbols server and the feed will have different builds of the package. Microsoft says its important that symbols are come from the exact same build as the assembly they reference.

To make sure both the feed and the symbol server have the same build I need to manually delete the package from the feed before running my release script again. A -Force option would remove the need to manually delete anything.

Today i needed this for the exact reason pointed out already. While testing packages before publish it doesn't seem practical to manually having to delete files in order to update without incrementing versions. Very dissapointed to see it has never been implemented.

Adding my support for this too. Same reasons, can't imagine it'd be too hard to implement.

Was this page helpful?
0 / 5 - 0 ratings