// Configures IIS features from custom features public static async Task ExecuteFromCustomFeaturesAsync() { Console.WriteLine(string.Empty); Console.WriteLine($@"> Configures IIS features from from custom features"); FeatureCommandsCollection commands = Configurator.CreateCommands(Configurator.GetAllFeatures(), CommandOptions.SilentModeDeactivated); commands.NotifyFeatureCommandCollectionExecuting += NotifyFeatureCommandCollectionExecuting; commands.NotifyFeatureCommandCollectionExecuted += NotifyFeatureCommandCollectionExecuted; commands.NotifyFeatureCommandsCollectionStart += NotifyFeatureCommandsCollectionStart; commands.NotifyFeatureCommandsCollectionFinish += NotifyFeatureCommandsCollectionFinish; await commands.ProcessAsync(); }
// Configures IIS features from XML configuration file public static async Task ExecuteFromXmlFileAsync() { Console.WriteLine(); Console.WriteLine($@"> Configures IIS features from XML configuration file"); IISModel model = IISModel.LoadFromFile("~\\resources\\IIS-Features.xml"); FeatureCommandsCollection commands = Configurator.CreateCommands(model, CommandOptions.SilentModeDeactivated); commands.NotifyFeatureCommandCollectionExecuting += NotifyFeatureCommandCollectionExecuting; commands.NotifyFeatureCommandCollectionExecuted += NotifyFeatureCommandCollectionExecuted; commands.NotifyFeatureCommandsCollectionStart += NotifyFeatureCommandsCollectionStart; commands.NotifyFeatureCommandsCollectionFinish += NotifyFeatureCommandsCollectionFinish; await commands.ProcessAsync(); }