Ejemplo n.º 1
0
        /// <summary>
        /// Gets services properties.
        /// </summary>
        public static List <ServiceItem> GetServiceItemList(
            TargetFramework targetFramework,
            string binaryPathName)
        {
            HashSet <ServiceItem> oldServices = GetInstalledServices();

            InstallService(
                targetFramework,
                binaryPathName);

            HashSet <ServiceItem> newServices = GetInstalledServices();

            newServices.ExceptWith(oldServices);

            foreach (var serviceItem in newServices)
            {
                serviceItem.TargetFramework = targetFramework;
                serviceItem.BinaryPathName  = GetInstalledServiceBinaryPathName(serviceItem.ServiceName);
            }

            ServiceTransaction.Begin(newServices.ToList());

            UninstallService(
                targetFramework,
                binaryPathName);

            ServiceTransaction.Commit();

            return(newServices.ToList());
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Deletes previously installed services.
        /// </summary>
        public static void DeletePreviouslyInstalledServices()
        {
            var services = ServiceTransaction.GetUncommited();

            foreach (var service in services)
            {
                UninstallService(
                    service.TargetFramework,
                    service.BinaryPathName);
            }

            if (services.Count > 0)
            {
                ServiceTransaction.Commit();
            }
        }