开发者

Nuget Clean Package Remove/Install

I'd like to remove an entire nuget package, and cleanly install it in my project again.

Sadly, for some reason it skips r开发者_StackOverflowemoving files that have been "modified", and then skips putting them in the project on reinstall, because they already exist.

Is there any flag i can set to unconditionally remove every single trace of a nuget package, alternatively overwrite all existing files?

Thanks.


Unfortunately at the moment, NuGet does not do what you want. During the uninstall process, NuGet will only delete content files if they have not been modified. And as you've noticed, the update process will not update files that were modified either.

The Uninstall-Package command does have a -Force option, but that is to "force" uninstall even if there are other packages that depend on this one.

We can certainly file this as an issue and perhaps incorporate it into a future version.

Another option would be to create a PowerShell script that will enumerate a package's contents, then allow you to delete all the content files. I'll see if there is a simple way to do this.

BTW: Perhaps you can figure out a better way to extend the existing content file other than modifying it directly. Especially since you're losing your changes when the package is updated.


You can now do what you want! (finally)

You need to first update to the latest NuGet (I think this feature was added around April 2013). Do this by going to Tools > Extensions and Updates and click on Updates to update nuget.

Then the -FileConflictAction parameter will allow you to overwrite files.

Install-Package Microsoft.jQuery.Unobtrusive.Validation -Version 2.0.30506.0 -FileConflictAction Overwrite

(PowerShell Command Reference for Install-Package)


The NuGet Version 1.6 HAS a remove package function! http://docs.nuget.org/docs/release-notes/nuget-1.6

if the update of the extension fails (signatur missmatch), just uninstall and reinstall. this is a known problem.


I think this happened to me a few times. Go to the packages.config file that should be the root directory of your project and remove the insurgent (in your case the line with the package: SignalR). This will tell NuGet that the package was never installed.

Now you will be able to reinstall it through the repository, then uninstall it so everything is back to the way it was before you got into this mess. I am unsure how it is occurring.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜