Interactivity during package installing

Jul 25, 2011 at 7:52 PM
Edited Jul 25, 2011 at 7:52 PM

My package is for some library with extensibility points. Let's call them as "Data Providers". Library contains out-of-the-box "provider" for MSSQL and for Oracle. I'd like to allow user to decide which provider to use. I understand that I can create three packages: main lib, "provider 1", "provider 2". But this is not very handy as a user will have to install two packages always.

Can I customize installation process to allow some interactivity with a package user?

If to think in general terms it's pretty common to ask a user for something before install a library...

Just an idea: it'd be nice to have a notion of "package parameters". They could be supplied directly to Install-Package and if not then are requested from user...

Jul 26, 2011 at 4:09 AM

> But this is not very handy as a user will have to install two packages always.

They would actually only have to install one package.

When they install YourLib.MSSQL, NuGet would automatically install YourLib behind the scenes because it’d be marked as a dependency.

-- Tatham

From: EvilShrike [email removed]
Sent: Tuesday, 26 July 2011 4:52 AM
To: Tatham Oddie
Subject: Interactivity during package installing [nuget:266503]

From: EvilShrike

My package is for some library with extensibility points. Let's call them as "Data Providers". Library contains out-of-the-box "provider" for MSSQL and for Oracle. I'd like to allow user to decide which provider to use. I understan that I can create three package: main lib, "provider 1", "provider 2". But this is not very handy as a user will have to install two packages always.

Can I customize installation process to allow some interactivity with a package user?

If to think in general terms it's pretty common to ask a user for something before install a library...

Just an idea: it'd be nice to have a notion of "package parameters". They could be supplied directly to Install-Package and if not then are requested from user...

Jul 26, 2011 at 10:03 AM

Ok, one. But anyway. Let me try to explain. "Data providers" in my example is just only one branch (if "mssql" then "providerMsSql" else if "oracle" then "providerOracle"). But a library can have many such branches. I mean a library has many extensibility points and for each (or many) of them there are several default implementations. The library's package can contains all of them. But each implementation lives usually in a separate assembly. So during package installing target project will get references to all of them. This is undesirable.

 

Developer
Jul 26, 2011 at 10:08 AM

We don't plan to add support for this since it can get really hairy when you have big dependency chains. Any package you depend on that has a set of options will causes prompts as well. For now the recommendation is the create different sets of packages (which can be hairy as well but packages like nhibernate do this today). Another option is to create your own tool "installer" command that knows how to prompt the user for different options.

Jul 26, 2011 at 10:22 AM

I understand your point. But honestly I don't see much troubles if dependent packages will ask for parameters. Moreover a package being installed can supply additional parameters to a package it depends on (to narrow possible options). It's possible to provide two modes: default "full" (without asking for parameters) and "manual" (and "full" would be used if a package is being installed by another package)

But ok, you won't introduce package parameters. So my question now is only how can I restrict adding refenreces to assemblies in "lib" folder? They all are made referenced by target project automatically, can I prevent adding a refenrece to some assembly but continue to keep it in "lib" folder?

Developer
Jul 26, 2011 at 10:27 AM

That feature is coming in the next version of nuget :). How do you plan to use that feature though?

Jul 26, 2011 at 10:31 AM

I'd turn off adding references to "optional" assemblies, then in install.ps1 run some my "installer" (from "tools" folder) which would ask a user for options and programatically add needed references to current project. Will it be possible?