/// <summary>
        ///     Excutes the uninstall script
        /// </summary>
        /// <param name="installed">Installed package</param>
        /// <param name="parameters">Parameters to pass to the script</param>
        /// <param name="optionalScript">optional additiona script to execute</param>
        private static void ExecuteRemoveScript(PackageInfo installed, Dictionary <string, string> parameters, string optionalScript, ILogger logger)
        {
            if (optionalScript != null && optionalScript.Trim().Length > 0)
            {
                logger.Log("Executing uninstallation script specified as parameter...");
                PowershellHelpers.ExecuteScript(installed.InstallationDirectory, optionalScript, logger, parameters);
                return;
            }

            if (File.Exists(Path.Combine(installed.InstallationDirectory, "Uninstall.ps1")))
            {
                logger.Log("Executing uninstall script contained in package ... ");

                PowershellHelpers.Execute(installed.InstallationDirectory, "Uninstall.ps1", installed.Configuration, logger, parameters);
            }
        }
Exemple #2
0
        /// <summary>
        ///     Searches for an install script and executes it passing the configuration as parameter
        /// </summary>
        /// <param name="info">Pacakge installation informations</param>
        private static void ExecuteInstallScript(PackageInfo info, Dictionary <string, string> parameters, string installScript, ILogger logger)
        {
            if (installScript != null && installScript.Trim().Length > 0)
            {
                logger.Log("Executing install script passed as parameter");

                PowershellHelpers.ExecuteScript(info.InstallationDirectory, installScript, logger, parameters);
            }

            var file = Path.Combine(info.InstallationDirectory, "install.ps1");

            if (File.Exists(file))
            {
                logger.Log("Executing install script inside package...");
                PowershellHelpers.Execute(info.InstallationDirectory, "install.ps1", info.Configuration, logger, parameters);
            }
        }