Nesting a feature under the default feature

Jun 9, 2015 at 5:20 PM
I'd like to nest a feature under the auto-generated feature - because i'd rather not specify my own 'root' feature for every item in my project. It doesn't look like there are any hooks to do this without manipulating the generated XML (which is fine, really).

If this is not possible out of the box, do you have any thoughts on how it could look? I was going to take a crack at it tonight, possibly.
Jun 10, 2015 at 10:53 AM
It is rather an API challenge. I am not sure what would be the best (friendlies) syntax for this.
May be project.RootFeature (with the default initialization) is the way to go.
//explicit root feature
var all = new Feature("Complete"); 
var bin = new Feature("Application"); 
var docs = new Feature("Documents"); 
all.Children.AddRange(bin, docs);

var project = new Project("MyProduct",
    new Dir(@"%ProgramFiles%\My Company\My Product",
        new File(bin, @"Files\Bin\MyApp.exe"),
        new Dir(docs, @"Docs\Manual",
            new File(@"Files\Docs\Manual.txt")));

project.RootFeature = all;
//auto root feature
var bin = new Feature("Application"); 
var docs = new Feature("Documents"); 

var project = new Project("MyProduct",
    new Dir(@"%ProgramFiles%\My Company\My Product",
        new File(bin, @"Files\Bin\MyApp.exe"),
        new Dir(docs, @"Docs\Manual",
            new File(@"Files\Docs\Manual.txt")));

project.RootFeature.Children.AddRange(bin, docs);
But probably a better option to call "project.RootFeature.Children.AddRange" automatically for all discovered top-level features unless project.RootFeature is set explicitly.

BTW if you do anything with Features get the latest code from Git there are some changes in this area.