public override async Task ExecuteAsync(TextWriter output)
        {
            var instances = await whereService.GetAllInstancesAsync(Descriptor.Options);

            if (!Descriptor.All)
            {
                instances = new Chooser().ChooseMany(instances, output);
            }

            var extra =
                !Descriptor.ExtraArguments.Any(x => x.TrimStart('-') == "config") && File.Exists(".vsconfig") ?
                Descriptor.ExtraArguments.Add("--config").Add(".vsconfig") :
                Descriptor.ExtraArguments;

            foreach (var instance in instances)
            {
                var args = new List <string>(extra)
                {
                    "--passive",
                    "--installPath",
                    instance.InstallationPath
                };

                await installerService.UpdateAsync(instance.GetChannel(), instance.GetSku(), args, output);
            }
        }
Exemple #2
0
        public override async Task ExecuteAsync(TextWriter output)
        {
            var instances = await whereService.GetAllInstancesAsync(Descriptor.Options);

            var instance = new Chooser().Choose(instances, output);

            if (instance != null)
            {
                var args = new List <string>();

                if (Descriptor.WorkloadsAdded.Any() || Descriptor.WorkloadsRemoved.Any() || Descriptor.ExtraArguments.Contains("--config"))
                {
                    args.Add("--passive"); // otherwise let the user to select the workload in the UI
                }
                args.AddRange(Descriptor.WorkloadsAdded);
                args.AddRange(Descriptor.WorkloadsRemoved);

                args.Add("--installPath");
                args.Add(instance.InstallationPath);

                args.AddRange(Descriptor.ExtraArguments);

                await installerService.ModifyAsync(instance.GetChannel(), instance.GetSku(), args, output);
            }
        }