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,13 +3,23 @@
<?include Config.wxi?> <?include Config.wxi?>
<?define VERSION="2.1"?> <?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"> <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" />
<Package InstallerVersion="200" Compressed="yes" />
<Media Id="1" EmbedCab="yes" Cabinet="schedulerservice.cab" /> <Media Id="1" EmbedCab="yes" Cabinet="schedulerservice.cab" />
<Feature Id="ProductFeature" Title="WebsitePanel Scheduler Service Installer" Level="1"> <Feature Id="ProductFeature" Title="WebsitePanel Scheduler Service Installer" Level="1">
<ComponentRef Id="ProductFiles" /> <ComponentRef Id="ProductFiles" />
</Feature> </Feature>
<Property Id="BannerBitmap">bannrbmp</Property> <Property Id="BannerBitmap">bannrbmp</Property>
<WixVariable Id="WixUIBannerBmp" Value="bannrbmp.bmp" />
<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="WixUIDialogBmp" Value="dlgbmp.bmp" />
<WixVariable Id="WixUILicenseRtf" Value="License.rtf" /> <WixVariable Id="WixUILicenseRtf" Value="License.rtf" />
<Icon Id="WebSitePanel.ico" SourceFile="WebSitePanel.ico" /> <Icon Id="WebSitePanel.ico" SourceFile="WebSitePanel.ico" />
@ -95,7 +105,9 @@
<TextStyle Id="DlgTitleFont" FaceName="Tahoma" Size="8" Bold="yes" /> <TextStyle Id="DlgTitleFont" FaceName="Tahoma" Size="8" Bold="yes" />
</UI> </UI>
<InstallExecuteSequence> <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> </InstallExecuteSequence>
</Product> </Product>
<Fragment> <Fragment>
@ -103,8 +115,13 @@
<Binary Id="CheckConnection.CA" SourceFile="bin\WebsitePanel.SchedulerServiceInstaller.CA.dll" /> <Binary Id="CheckConnection.CA" SourceFile="bin\WebsitePanel.SchedulerServiceInstaller.CA.dll" />
</Fragment> </Fragment>
<Fragment> <Fragment>
<CustomAction Id="FinalizeInstall" BinaryKey="CheckConnection.CA" DllEntry="FinalizeInstall" /> <CustomAction Id="FinalizeInstall" BinaryKey="CheckConnection.CA" DllEntry="FinalizeInstall" />
</Fragment> </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> <Fragment>
<Directory Id="TARGETDIR" Name="SourceDir"> <Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="WEBSITEPANELFOLDER" Name="WebsitePanel"> <Directory Id="WEBSITEPANELFOLDER" Name="WebsitePanel">
@ -115,8 +132,8 @@
<Fragment> <Fragment>
<DirectoryRef Id="INSTALLFOLDER"> <DirectoryRef Id="INSTALLFOLDER">
<Component Id="ProductFiles" Guid="A89FA6CF-53E2-4390-9E9D-11CD4297D739"> <Component Id="ProductFiles" Guid="A89FA6CF-53E2-4390-9E9D-11CD4297D739">
<File Id="WebsitePanel.SchedulerService.exe" Source="$(var.BUILDPATH)\WebsitePanel.SchedulerService.exe" /> <File Id="WebsitePanel.SchedulerService.exe" Source="$(var.BUILDPATH)\WebsitePanel.SchedulerService.exe" />
<File Id="WebsitePanel.SchedulerService.exe.config" Source="$(var.BUILDPATH)\WebsitePanel.SchedulerService.exe.config" /> <File Id="WebsitePanel.SchedulerService.exe.config" Source="$(var.BUILDPATH)\WebsitePanel.SchedulerService.exe.config" />
<File Id="Ionic.Zip.Reduced.dll" Source="$(var.SERVERBUILDPATH)\Ionic.Zip.Reduced.dll"/> <File Id="Ionic.Zip.Reduced.dll" Source="$(var.SERVERBUILDPATH)\Ionic.Zip.Reduced.dll"/>
<File Id="Microsoft.Web.Services3.dll" Source="$(var.SERVERBUILDPATH)\Microsoft.Web.Services3.dll"/> <File Id="Microsoft.Web.Services3.dll" Source="$(var.SERVERBUILDPATH)\Microsoft.Web.Services3.dll"/>
<File Id="WebsitePanel.Common.Utils.dll" Source="$(var.BUILDPATH)\WebsitePanel.Common.Utils.dll"/> <File Id="WebsitePanel.Common.Utils.dll" Source="$(var.BUILDPATH)\WebsitePanel.Common.Utils.dll"/>

View file

@ -34,6 +34,7 @@ using System.IO;
using System.Linq; using System.Linq;
using System.ServiceProcess; using System.ServiceProcess;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.Threading;
using Microsoft.Deployment.WindowsInstaller; using Microsoft.Deployment.WindowsInstaller;
using WebsitePanel.Setup; using WebsitePanel.Setup;
@ -69,6 +70,14 @@ namespace WebsitePanel.SchedulerServiceInstaller
return ActionResult.Success; return ActionResult.Success;
} }
[CustomAction]
public static ActionResult FinalizeUnInstall(Session session)
{
UnInstallService();
return ActionResult.Success;
}
private static void InstallService(string installFolder) private static void InstallService(string installFolder)
{ {
try 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) private static void ChangeCryptoKey(string installFolder)
{ {
string path = Path.Combine(installFolder.Replace("SchedulerService", "Enterprise Server"), "web.config"); string path = Path.Combine(installFolder.Replace("SchedulerService", "Enterprise Server"), "web.config");