scheduler installer fix

This commit is contained in:
a.skorina 2014-12-15 11:35:56 +03:00
parent bc94c24ca4
commit 08de3dd338
2 changed files with 52 additions and 6 deletions

View file

@ -3,12 +3,22 @@
<?include Config.wxi?>
<?define VERSION="2.1"?>
<Product Id="*" Name="WebsitePanel Scheduler Service Installer" Language="1033" Version="$(var.VERSION)" Manufacturer="Outercurve Foundation" UpgradeCode="629ccd5c-1f6d-4168-bbe6-01c69e232f44">
<Package InstallerVersion="200" Compressed="yes" />
<Media Id="1" EmbedCab="yes" Cabinet="schedulerservice.cab" />
<Feature Id="ProductFeature" Title="WebsitePanel Scheduler Service Installer" Level="1">
<ComponentRef Id="ProductFiles" />
</Feature>
<Property Id="BannerBitmap">bannrbmp</Property>
<Property Id="PREVIOUSVERSIONSINSTALLED" Secure="yes" />
<Upgrade Id="629ccd5c-1f6d-4168-bbe6-01c69e232f44">
<UpgradeVersion
Minimum="1.0.0.0" Maximum="99.0.0.0"
Property="PREVIOUSVERSIONSINSTALLED"
IncludeMinimum="yes" IncludeMaximum="no" />
</Upgrade>
<WixVariable Id="WixUIBannerBmp" Value="bannrbmp.bmp" />
<WixVariable Id="WixUIDialogBmp" Value="dlgbmp.bmp" />
<WixVariable Id="WixUILicenseRtf" Value="License.rtf" />
@ -95,7 +105,9 @@
<TextStyle Id="DlgTitleFont" FaceName="Tahoma" Size="8" Bold="yes" />
</UI>
<InstallExecuteSequence>
<Custom Action="FinalizeInstall" After="InstallFinalize" />
<Custom Action="FinalizeUnInstall" After="InstallValidate">(NOT UPGRADINGPRODUCTCODE) AND (REMOVE="ALL")</Custom>
<RemoveExistingProducts After="InstallValidate" />
<Custom Action='FinalizeInstall' After='InstallFinalize'>NOT Installed or REINSTALL</Custom>
</InstallExecuteSequence>
</Product>
<Fragment>
@ -105,6 +117,11 @@
<Fragment>
<CustomAction Id="FinalizeInstall" BinaryKey="CheckConnection.CA" DllEntry="FinalizeInstall" />
</Fragment>
<Fragment>
<CustomAction Id="FinalizeUnInstall" BinaryKey="CheckConnection.CA" DllEntry="FinalizeUnInstall" />
<CustomAction Id='AlreadyUpdated' Error='Product has already been updated to $(var.VERSION) or newer.' />
<CustomAction Id='NoDowngrade' Error='A later version of [ProductName] is already installed.' />
</Fragment>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="WEBSITEPANELFOLDER" Name="WebsitePanel">

View file

@ -34,6 +34,7 @@ using System.IO;
using System.Linq;
using System.ServiceProcess;
using System.Text.RegularExpressions;
using System.Threading;
using Microsoft.Deployment.WindowsInstaller;
using WebsitePanel.Setup;
@ -69,6 +70,14 @@ namespace WebsitePanel.SchedulerServiceInstaller
return ActionResult.Success;
}
[CustomAction]
public static ActionResult FinalizeUnInstall(Session session)
{
UnInstallService();
return ActionResult.Success;
}
private static void InstallService(string installFolder)
{
try
@ -93,6 +102,26 @@ namespace WebsitePanel.SchedulerServiceInstaller
}
}
private static void UnInstallService()
{
try
{
var schedulerService =
ServiceController.GetServices().FirstOrDefault(
s => s.DisplayName.Equals("WebsitePanel Scheduler", StringComparison.CurrentCultureIgnoreCase));
if (schedulerService != null)
{
StopService(schedulerService.ServiceName);
SecurityUtils.DeleteService(schedulerService.ServiceName);
}
}
catch (Exception)
{
}
}
private static void ChangeCryptoKey(string installFolder)
{
string path = Path.Combine(installFolder.Replace("SchedulerService", "Enterprise Server"), "web.config");