Should I want my package to uninstall its dependencies?

Jun 10, 2011 at 2:24 PM

I have a Client.MVC package that depends on a Client and Core package. Client and Core are for all intensive purposes are only useful as a single package with the Client.MVC package.

If I uninstall Client.MVC i still have to manually uninstall Core/Client. This doesn't feel like what I want. That I want the uninstall.ps1 to remove the dependencies also as I would view removing the Client.MVC package is logically removing the entire system.

Should I be looking at things in this manner?

Are there any downsides to this if I would actually achieve this, such as it complicating package upgrades?

Assuming there's no massive reason I wouldn't want to do this, how do i even achieve this? I can't really find much guidance of what I can, or what I would actually want to do in regards to the uninstall.ps1

Jun 10, 2011 at 2:42 PM

If you're patterning after what other folks are doing (i.e. jQuery Docs), then no.  EntityFramework also adds references to framework libraries and does not remove them when you uninstall.

For the most part, I think most packages can't guess that the user hasn't taken on the dependency in another fashion, so you wouldn't want to make a mess.

Possibly the best thing to do would be a Write-Host with a list of the files saying, "Dear user, here's what I did when I installed. If you're not needing these, go ahead and remove them manually."


Jun 10, 2011 at 6:39 PM

If you use the Package Manager Console, you can specify the -RemoveDependencies flag to do this. This option doesn't not currently exist in the UI.

Jun 10, 2011 at 7:01 PM

This option will be available in NuGet 1.5

Jun 13, 2011 at 7:22 PM
dotnetjunky wrote:

This option will be available in NuGet 1.5

Are you saying that the -RemoveDependencies flag will be added in 1.5, or that the RemoveDependencies flag exists currently and that the UI support for this will be added to 1.5?

Jun 13, 2011 at 7:23 PM

The latter.

Jun 13, 2011 at 8:36 PM

Thanks for the feedback guys, with this all being said I'll not concern myself with it since the UI will accomplish it later.