Why does Bootstrapper hang when detecting FilesInUse? - wix

I am using WiX Toolset v3.10.0.1726
I have a .msi-file that gets bundled within a bootstrapper.
MSI Defintion:
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*"
Name="$(var.ProductName)"
Language="!(loc.ProductLanguage)"
Version="!(bind.fileVersion.FILE)"
Manufacturer="$(var.Manufacturer)"
UpgradeCode="$(var.UpgradeCode)">
<Package InstallerVersion="200"
Compressed="yes"
InstallScope="perMachine"
Platform="x86"
InstallPrivileges="elevated"
ReadOnly="yes" />
<MediaTemplate EmbedCab="yes" />
<?include Feature.wxi?>
<MajorUpgrade AllowDowngrades="no"
AllowSameVersionUpgrades="yes"
DowngradeErrorMessage="!(loc.DowngradeErrorMessage)" />
<UI Id="UserInterface">
<Property Id="WIXUI_INSTALLDIR"
Value="TARGETDIR" />
<Property Id="WixUI_Mode"
Value="Custom" />
<TextStyle Id="WixUI_Font_Normal"
FaceName="Tahoma"
Size="8" />
<TextStyle Id="WixUI_Font_Bigger"
FaceName="Tahoma"
Size="9"
Bold="yes" />
<TextStyle Id="WixUI_Font_Title"
FaceName="Tahoma"
Size="9"
Bold="yes" />
<Property Id="DefaultUIFont"
Value="WixUI_Font_Normal" />
<DialogRef Id="ProgressDlg" />
<DialogRef Id="ErrorDlg" />
<DialogRef Id="FilesInUse" />
<DialogRef Id="FatalError" />
<DialogRef Id="UserExit" />
<Publish Dialog="ProgressDlg"
Control="Next"
Event="EndDialog"
Value="Return"
Order="2" />
</UI>
</Product>
</Wix>
If executing the .msi-file directly, FilesInUse dialog shows up correctly if the application is running. Everything is working fine.
Now I've integrated the .msi-file in a bootstrapper:
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:bal="http://schemas.microsoft.com/wix/BalExtension">
<Bundle Name="!(bind.packageName.Setup)"
Version="!(bind.packageVersion.Setup)"
Manufacturer="!(bind.packageManufacturer.Setup)"
UpgradeCode="$(var.UpgradeCode)"
DisableModify="yes">
<BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.HyperlinkLicense">
<bal:WixStandardBootstrapperApplication LicenseUrl=""
SuppressOptionsUI="no"
ShowVersion="yes"
SuppressRepair="yes"
LogoFile="Resources/dpd.png" />
</BootstrapperApplicationRef>
<Chain DisableSystemRestore="yes">
<MsiPackage Id="Setup"
Compressed="yes"
Name="$(var.ProductName)"
SourceFile="setup.msi"
DisplayInternalUI="yes"
Vital="yes" />
</Chain>
</Bundle>
</Wix>
I need DisplayInternalUI as I am having some extra dialogs in the .msi-file which are mandatory for the setup.
If the application is not running in an upgrade scenario everything is working fine, whereas a running application while upgrading brings the bootstrapper and the .msi-file into a not responding state.
The output of the log:
[2A34:28F0][2015-07-21T16:38:40]i001: Burn v3.10.0.1726, Windows v6.1
(Build 7601: Service Pack 1), path: W:\work\SETUP.exe ...
[2A34:28F0][2015-07-21T16:38:40]i009: Command Line: '-burn.unelevated
BurnPipe.{571E9E94-4908-45EE-A6AC-05F923FAFDCF}
{F7B2FBA0-BAEB-42C7-B1D5-B8704F153049} 10904 /log log.txt'
... [2A34:28F0][2015-07-21T16:38:41]i300: Apply begin
... [2A98:054C][2015-07-21T16:38:42]i301: Applying execute
package: Setup, action: Install, path: C:\ProgramData\Package
Cache{99D06386-9447-4D7B-8307-E53C12BB09B5}v2.0.19.28124\FOOAPPLICATION,
arguments: ' ARPSYSTEMCOMPONENT="1" MSIFASTINSTALL="7"
INSTALLFOLDER="C:\FOOFOLDER" TRANSFORMS=":1031"'
And the output of the msi-log (at least the last relevant lines):
...
MSI (s) (24:D4) [16:38:42:826]: Doing action: InstallValidate
MSI (s) (24:D4) [16:38:42:827]: PROPERTY CHANGE: Deleting
MsiRestartManagerSessionKey property. Its current value is
'053651647df31e46971d3237c9eb6a06'. MSI (s) (24:D4)
[16:38:42:827]: Transforming table Dialog. ... MSI (s)
(24:D4) [16:38:42:828]: Note: 1: 2205 2: 3: BindImage MSI (s)
(24:D4) [16:38:42:828]: Note: 1: 2205 2: 3: ProgId MSI (s)
(24:D4) [16:38:42:828]: Note: 1: 2205 2: 3: PublishComponent
MSI (s) (24:D4) [16:38:42:828]: Note: 1: 2205 2: 3: SelfReg MSI
(s) (24:D4) [16:38:42:828]: Note: 1: 2205 2: 3: Extension MSI
(s) (24:D4) [16:38:42:828]: Note: 1: 2205 2: 3: Font MSI (s)
(24:D4) [16:38:42:828]: Note: 1: 2205 2: 3: Class MSI (s)
(24:D4) [16:38:42:828]: Note: 1: 2205 2: 3: TypeLib MSI (s)
(24:D4) [16:38:42:829]: Note: 1: 2205 2: 3: _RemoveFilePath MSI
(s) (24:D4) [16:38:42:993]: Note: 1: 1402 2: HKEY_CLASSES_ROOT.NET 3:
2 MSI (s) (24:D4) [16:38:43:127]: Note: 1: 1402 2:
HKEY_CLASSES_ROOT.NET 3: 2 MSI (s) (24:D4) [16:38:43:221]:
PROPERTY CHANGE: Modifying CostingComplete property. Its current value
is '0'. Its new value: '1'. MSI (s) (24:D4) [16:38:43:222]:
Note: 1: 2205 2: 3: BindImage MSI (s) (24:D4) [16:38:43:222]:
Note: 1: 2205 2: 3: ProgId MSI (s) (24:D4) [16:38:43:222]:
Note: 1: 2205 2: 3: PublishComponent MSI (s) (24:D4)
[16:38:43:222]: Note: 1: 2205 2: 3: SelfReg MSI (s) (24:D4)
[16:38:43:222]: Note: 1: 2205 2: 3: Extension MSI (s) (24:D4)
[16:38:43:222]: Note: 1: 2205 2: 3: Font MSI (s) (24:D4)
[16:38:43:222]: Note: 1: 2205 2: 3: Class MSI (s) (24:D4)
[16:38:43:222]: Note: 1: 2205 2: 3: TypeLib MSI (s) (24:D4)
[16:38:43:222]: Note: 1: 2727 2: MSI (s) (24:D4) [16:38:43:314]:
Transforming table Error. MSI (s) (24:D4) [16:38:43:314]:
Transforming table Error. MSI (c) (98:4C) [16:38:43:326]:
RESTART MANAGER: Session opened.
So, why does the msi in the bootstrapped scenario hang (and causes the bootstrapper to hang either), and how do I fix this?

You skip the creation of a system restore point due to the DisableSystemRestore value on your chain but you did not do a similar thing in your msi. You can skip the creation of restore points in your msi by setting the MSIFASTINSTALL property. Works with MSI 5.0 as described here: http://msdn.microsoft.com/en-us/library/dd408005(VS.85).aspx
<!-- Add me to your MSI definition -->
<Property Id="MSIFASTINSTALL" Value="1" />

Related

Shortcut (non-advertised) not being created with Wix installer?

I built a simple MSI installer with Wix 3.11. It includes an EXE and a shortcut, but the shortcut never appears on the desktop. I build the MSI without errors, it otherwise installs just fine, and there are no errors in the MSI log file. I viewed the MSI with Orca and I see the shortcut and desktop directory in their tables. Thoughts? I've tried setting ALLUSERS to 1 as well to no avail. Here is my wxs file:
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" Name="Imaginary Product" Language="1033"
Version="1.2.3.4" Manufacturer="Company" UpgradeCode="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx">
<Package Id="*" InstallerVersion='300' Compressed='yes'/>
<Media Id="1" Cabinet="ImaginaryProduct.cab" EmbedCab="yes"/>
<?if $(sys.BUILDARCH)="x64" ?>
<?define Win64 = "yes" ?>
<?define PlatformProgramFilesFolder = "ProgramFiles64Folder" ?>
<?else ?>
<?define Win64 = "no" ?>
<?define PlatformProgramFilesFolder = "ProgramFilesFolder" ?>
<?endif ?>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="DesktopFolder" SourceName="Desktop">
<Component Id="MainExecutableShortcut" Guid="{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}">
<Shortcut Id="ImaginaryUIEXEShortcut" Name="Imaginary UI" Description="Runs Imaginary UI" Target="ImaginaryUI.exe" WorkingDirectory="ProductProgramFilesFolder"/>
<RemoveFolder Id="RemoveDesktopFolder" Directory="DesktopFolder" On="uninstall"/>
<RegistryValue Root="HKCU" Key="Software\Microsoft\ImaginaryUI" Name="installed" Type="integer" Value="1" KeyPath="yes"/>
</Component>
</Directory>
<Directory Id="$(var.PlatformProgramFilesFolder)">
<Directory Id="ManufacturerProgramFilesFolder" Name="Company">
<Directory Id="ProductProgramFilesFolder" Name="Imaginary Product">
<Component Id="MainExecutable" Guid="{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}">
<File Id="ImaginaryUIEXE" Name="ImaginaryUI.exe" Vital="yes" Source=".\bin\$(var.Configuration)\ImaginaryUI.exe" KeyPath="yes"/>
</Component>
</Directory>
</Directory>
</Directory>
</Directory>
<Feature Id='MainApplication' Level='1'>
<ComponentRef Id="MainExecutable" Primary="yes"/>
<ComponentRef Id="MainExecutableShortcut" Primary="yes"/>
</Feature>
</Product>
</Wix>
Update: when the shortcut doesn't specify and icon, I see this in the installer log:
Action start 16:27:50: CreateShortcuts.
MSI (s) (08:34) [16:27:50:522]: Note: 1: 2205 2: 3: Icon
MSI (s) (08:34) [16:27:50:522]: Note: 1: 2228 2: 3: Icon 4: SELECT `Name`, `Data` FROM `Icon`
MSI (s) (08:34) [16:27:50:522]: Note: 1: 2205 2: 3: MsiShortcutProperty
MSI (s) (08:34) [16:27:50:523]: Note: 1: 2205 2: 3: MsiShortcutProperty
Action ended 16:27:50: CreateShortcuts. Return value 1.
When I do specify one, I see even less:
MSI (s) (14:D0) [16:34:59:527]: Doing action: CreateShortcuts
MSI (s) (14:D0) [16:34:59:527]: Note: 1: 2205 2: 3: ActionText
Action start 16:34:59: CreateShortcuts.
MSI (s) (14:D0) [16:34:59:528]: Note: 1: 2205 2: 3: MsiShortcutProperty
MSI (s) (14:D0) [16:34:59:528]: Note: 1: 2205 2: 3: MsiShortcutProperty
Action ended 16:34:59: CreateShortcuts. Return value 1.
So, no indication of failure. The icon just goes into the ether.
I'm not sure if this is your issue but to use the desktop folder you just define it as
<Directory Id="DesktopFolder"/>
I think you are actually putting the shortcut in "C:\Desktop\" (assuming the TARGETDIR is C:). All System Folder Properties should be defined the same way.
Also, remove this from your component definitions
<RemoveFolder Id="RemoveDesktopFolder" Directory="DesktopFolder" On="uninstall"/>
You don't want to remove the Desktop folder, it's not something you created in your install and neither is it something you own. Also, RemoveFolder will not do anything if anything else is present in that folder and basically everyone has at least a Recycle Bin in their desktop folder so it will never do anything.
I'm not sure why the RemoveFolder is used in other Shortcut definitions like the startmenu. It may be due to how windows installer works where it only implicitly removes a folder if components containing Files were present.
I'm pretty sure that Target must be an ID, not the name of the file. So change
Target="ImaginaryUI.exe"
to
Target="[#ImaginaryUIEXE]"

WIX does not remove the web applications after uninstall in wix

We are using WIX 3.10 to create web applications under default website, this implementation works fine but the issue is with uninstall of the product that it does not remove the web application under the default website.
The Website port and name are entered by user as part of custom dialog which are stored in respective properties.further during uninstall these properties are restored using wix toolset remember property http://robmensching.com/blog/posts/2010/5/2/the-wix-toolsets-remember-property-pattern/ which sets the web application property during uninstall, but still the application is not removed on uninstall.
Uninstall log that sets the website properties after Appsearch:
Action start 15:17:04: AppSearch.
MSI (s) (24:64) [15:17:04:657]: Note: 1: 2262 2: Signature 3: -2147287038
MSI (s) (24:64) [15:17:04:657]: PROPERTY CHANGE: Modifying WEBSITEPORTPROPERTY property. Its current value is 'WEBSITEPORT'. Its new value: '80'.
MSI (s) (24:64) [15:17:04:657]: Note: 1: 2262 2: Signature 3: -2147287038
MSI (s) (24:64) [15:17:04:657]: PROPERTY CHANGE: Modifying WEBSITEPROPERTY property. Its current value is 'WEBSITE'. Its new value: 'Default Web Site'.
<Fragment>
<iis:WebSite Id="SITE" Description="[WEBSITE]">
<iis:WebAddress Id="AllUnassigned" Port="[WEBSITEPORT]"/>
</iis:WebSite>
<DirectoryRef Id="INSTALLFOLDER">
<Component Id="TestAppPool" Guid="GUID" KeyPath="yes" Permanent="yes">
<iis:WebAppPool Id="TestAppPool"
Name="Test Net 4.0"
Identity="applicationPoolIdentity"
ManagedPipelineMode="Integrated"
ManagedRuntimeVersion="v4.0" />
</Component>
<Component Id="IIS.Component" Guid="GUID" KeyPath="yes" Permanent="no" Win64="yes">
<iis:WebVirtualDir Id="VirtualDir" Alias="[APPLICATION_NAME]" Directory="Dir" WebSite="SITE" >
<iis:WebApplication Id="Application" Name="[APPLICATION_NAME]" WebAppPool="TestAppPool"/>
</iis:WebVirtualDir>
<RegistryValue Root='HKLM' Key='SOFTWARE\Test\Prod' Name='Website' Value='[WEBSITE]' Type='string' Action='write' />
<RegistryValue Root='HKLM' Key='SOFTWARE\Test\Prod' Name='WebsitePort' Value='[WEBSITEPORT]' Type='string' Action='write' />
<RegistryValue Root='HKLM' Key='SOFTWARE\Test\Prod' Name='Application' Value='[APPLICATION_NAME]' Type='string' Action='write' />
</Component>
</DirectoryRef>
</Fragment>
There is another issue related, repair operation through Add Remove Programs throws a Fatal error with the following error:
WriteIIS7ConfigChanges: Entering WriteIIS7ConfigChanges in C:\Windows\Installer\MSICDDF.tmp, version 3.10.3007.0
WriteIIS7ConfigChanges: Custom action data hash: 41034C345A4E6B9B4DDB8490C1BC5266637BC0E8
WriteIIS7ConfigChanges: CustomActionData WriteIIS7ConfigChanges length: 225
WriteIIS7ConfigChanges: Error 0x80070002: Site not found for create application
WriteIIS7ConfigChanges: Error 0x80070002: Failed to configure IIS application.
WriteIIS7ConfigChanges: Error 0x80070002: WriteIIS7ConfigChanges Failed.
Any other alternative solution that would solve the issue?

Wix/MSI - Major Upgrade in silent mode

I have an installer with upgrade support from our previous version:
<Product Id="*"
Name="$(var.ProductName)"
Language="1033"
Version="$(var.InstallerVersion)"
Manufacturer="$(var.Manufacturer)"
UpgradeCode="$(var.UpgradeCode)">
<Upgrade Id="$(var.UpgradeCode)">
<UpgradeVersion Minimum="$(var.InstallerVersion)" IncludeMinimum="no" OnlyDetect="yes" Property="NEWERVERSIONFOUND" />
<UpgradeVersion Minimum="5.0.0" IncludeMinimum="yes" Maximum="$(var.InstallerVersion)" IncludeMaximum="yes" Property="OLDERVERSIONFOUND" MigrateFeatures="yes" />
<UpgradeVersion Minimum="0.0.0" IncludeMinimum="yes" Maximum="5.0.0" IncludeMaximum="no" Property="OLDESTVERSIONFOUND" MigrateFeatures="yes" />
</Upgrade>
<InstallExecuteSequence>
<Custom Action="SetReInstallProperty" After="FindRelatedProducts">OLDERVERSIONFOUND OR OLDESTVERSIONFOUND</Custom>
<Custom Action="SetReInstallModeProperty" After="FindRelatedProducts">OLDERVERSIONFOUND OR OLDESTVERSIONFOUND</Custom>
<RemoveExistingProducts After="InstallInitialize">OLDERVERSIONFOUND OR OLDESTVERSIONFOUND</RemoveExistingProducts>
When I run this installer over older version 4.2 in UI mode, upgrade works fine. But when I run it in silent mode with /q, it runs in maintenance mode and try to uninstall itself.
This is the parts of log:
MSI (s) (EC:00) [10:49:44:999]: PROPERTY CHANGE: Adding ACTION property. Its value is 'INSTALL'.
MSI (s) (EC:00) [10:49:44:999]: Doing action: INSTALL
Action start 10:49:44: INSTALL.
MSI (s) (EC:00) [10:49:44:999]: Running ExecuteSequence
MSI (s) (EC:00) [10:49:45:000]: Doing action: FindRelatedProducts
Action start 10:49:45: FindRelatedProducts.
MSI (s) (EC:00) [10:49:45:000]: PROPERTY CHANGE: Adding OLDESTVERSIONFOUND property. Its value is '{16DF8961-26DE-4A05-B759-102976C5EA22}'.
MSI (s) (EC:00) [10:49:45:000]: PROPERTY CHANGE: Adding MIGRATE property. Its value is '{16DF8961-26DE-4A05-B759-102976C5EA22}'.
MSI (s) (EC:00) [10:49:45:001]: Doing action: SetReInstallModeProperty
Action ended 10:49:45: FindRelatedProducts. Return value 1.
Action start 10:49:45: SetReInstallModeProperty.
MSI (s) (EC:00) [10:49:45:001]: Doing action: SetReInstallProperty
Action ended 10:49:45: SetReInstallModeProperty. Return value 1.
MSI (s) (EC:00) [10:49:45:001]: PROPERTY CHANGE: Adding REINSTALL property. Its value is 'all'.
...
MSI (s) (EC:00) [10:49:47:605]: Doing action: MigrateFeatureStates
Action ended 10:49:47: ReadNCPExtensions. Return value 1.
MSI (s) (EC:00) [10:49:47:605]: Migrating feature settings from product(s) '{16DF8961-26DE-4A05-B759-102976C5EA22}'
Action start 10:49:47: MigrateFeatureStates.
MSI (s) (EC:00) [10:49:47:606]: Doing action: InstallValidate
Action ended 10:49:47: MigrateFeatureStates. Return value 1.
Action start 10:49:47: InstallValidate.
MSI (s) (EC:00) [10:49:47:606]: PROPERTY CHANGE: Deleting MsiRestartManagerSessionKey property. Its current value is '0c59f7d17b575b409c4f5593caddd7f9'.
MSI (s) (EC:00) [10:49:47:606]: Feature: MainFeature; Installed: Absent; Request: Null; Action: Null
MSI (s) (EC:00) [10:49:47:606]: Component: C.Name1.dll; Installed: Absent; Request: Null; Action: Null
MSI (s) (EC:00) [10:49:47:606]: Component: C.Name2.dll; Installed: Absent; Request: Null; Action: Null
...
MSI (s) (EC:00) [10:49:47:621]: PROPERTY CHANGE: Adding REMOVE property. Its value is 'ALL'.
MSI (s) (EC:00) [10:49:47:622]: Doing action: SetARPINSTALLLOCATION
Action ended 10:49:47: InstallValidate. Return value 1.
MSI (s) (EC:00) [10:49:47:622]: PROPERTY CHANGE: Adding ARPINSTALLLOCATION property. Its value is 'C:\Program Files (x86)\SmartDrive Systems Inc\SmartDrive Data Forwarding Gateway\'.
Action start 10:49:47: SetARPINSTALLLOCATION.
MSI (s) (EC:00) [10:49:47:622]: Doing action: InstallInitialize
Action ended 10:49:47: SetARPINSTALLLOCATION. Return value 1.
MSI (s) (EC:00) [10:49:47:622]: Machine policy value 'AlwaysInstallElevated' is 0
MSI (s) (EC:00) [10:49:47:622]: User policy value 'AlwaysInstallElevated' is 0
MSI (s) (EC:00) [10:49:47:622]: BeginTransaction: Locking Server
MSI (s) (EC:00) [10:49:47:623]: SRSetRestorePoint skipped for this transaction.
MSI (s) (EC:00) [10:49:47:623]: Server not locked: locking for product {D097B768-E833-4511-A1F6-E51BD1A02258}
Action start 10:49:47: InstallInitialize.
MSI (s) (EC:00) [10:49:47:936]: Doing action: RemoveExistingProducts
Action ended 10:49:47: InstallInitialize. Return value 1.
MSI (s) (EC:00) [10:49:47:937]: Skipping RemoveExistingProducts action: current configuration is maintenance mode or an uninstall
Action start 10:49:47: RemoveExistingProducts.
MSI (s) (EC:00) [10:49:47:937]: Doing action: ProcessComponents
Action ended 10:49:47: RemoveExistingProducts. Return value 0.
Action start 10:49:47: ProcessComponents.
MSI (s) (EC:00) [10:49:47:938]: Doing action: UnpublishFeatures
Action ended 10:49:47: ProcessComponents. Return value 1.
Action start 10:49:47: UnpublishFeatures.
MSI (s) (EC:00) [10:49:47:938]: Doing action: StopServices
Action ended 10:49:47: UnpublishFeatures. Return value 1.
Action start 10:49:47: StopServices.
MSI (s) (EC:00) [10:49:47:939]: Doing action: DeleteServices
Action ended 10:49:47: StopServices. Return value 1.
Action start 10:49:47: DeleteServices.
The main feature names in both installers is different. When I change feature name in new version to the same as in 4.2, upgrade works in silent mode, but stop working in UI mode with similar log: after MigrateFeatureState all components is in state Installed: Absent; Request: Null; Action: Null and REMOVE set to ALL.
Any ideas why it behave so strange?
I set main feature name the same as in old installer and removed my custom action SetReinstallProperty and upgrade works in both modes now.

Wix installer unexpected error

I am getting below error while running wix installer to install windows service:
The installer has encountered an unexpected error installing this package. This may indicate a problem with this package. The error code is 2343. The arguments are: , ,
MSI (s) (20:E0) [12:15:16:924]: Product: ABC.NS.Scheduler.Deployment.SCHEDULER -- The installer has encountered an unexpected error installing this package. This may indicate a problem with this package. The error code is 2343. The arguments are: ,
Below is the are the logs:
=== Logging started: 5/18/2015 12:15:16 ===
Action start 12:15:16: INSTALL.
Action start 12:15:16: FindRelatedProducts.
Action ended 12:15:16: FindRelatedProducts. Return value 1.
Action start 12:15:16: AppSearch.
Action ended 12:15:16: AppSearch. Return value 1.
Action start 12:15:16: LaunchConditions.
Action ended 12:15:16: LaunchConditions. Return value 1.
Action start 12:15:16: ValidateProductID.
Action ended 12:15:16: ValidateProductID. Return value 1.
Action start 12:15:16: CostInitialize.
Action ended 12:15:16: CostInitialize. Return value 1.
Action start 12:15:16: FileCost.
Action ended 12:15:16: FileCost. Return value 1.
Action start 12:15:16: CostFinalize.
Action ended 12:15:16: CostFinalize. Return value 1.
Action start 12:15:16: SetInstallLocationRootDirectory.
DEBUG: Error 2343: Specified path is empty.
The installer has encountered an unexpected error installing this package. This may indicate a problem with this package. The error code is 2343. The arguments are: , ,
MSI (s) (20:E0) [12:15:16:924]: Product: ABC.NS.Scheduler.Deployment.SCHEDULER -- The installer has encountered an unexpected error installing this package. This may indicate a problem with this package. The error code is 2343. The arguments are: , ,
Action ended 12:15:16: SetInstallLocationRootDirectory. Return value 3.
Action ended 12:15:16: INSTALL. Return value 3.
Property(S): UpgradeCode = {144D75A6-0CCB-4AAC-8547-C904DF2FAE7D}
Property(S): NETFRAMEWORK45 = #379893
CODE:
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
<?include Includes\Dependencies.wxi?>
<Product Id="{51669456-A144-4A44-BE32-958BB4E8CD3D}"
Name="ABC.NS.Scheduler.Deployment.SCHEDULER"
Language="1033"
Version="$(var.ProductVersion)"
Manufacturer="ABC"
UpgradeCode="144d75a6-0ccb-4aac-8547-c904df2fae7d">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<MajorUpgrade DowngradeErrorMessage="!(loc.LaterVersionAlreadyInstalled)" />
<PropertyRef Id="NETFRAMEWORK45"/>
<Condition Message="!(loc.DotNetFrameworkIsRequired)">
Installed OR NETFRAMEWORK45
</Condition>
<!-- Package the binaries in the msi -->
<Media Id="1" Cabinet="CABIIS.cab" EmbedCab="yes" />
<CustomAction Id="SetInstallLocationRootDirectory" Directory="INSTALLLOCATION" Execute="firstSequence" Value="[TARGET.INSTALLLOCATION]" />
<!-- Set the install location from the trigger file -->
<CustomAction Id="RunSCHEDULERInstall" Directory="TARGETDIR" Execute="deferred" Return="ignore" Impersonate="no" ExeCommand="[SCHEDULERIMPORTERFOLDER]ABC.NS.Scheduler.SCHEDULERService.exe install"/>
<CustomAction Id="RunSCHEDULERUninstall" Directory="TARGETDIR" Execute="deferred" Return="ignore" Impersonate="no" ExeCommand="[SCHEDULERIMPORTERFOLDER]ABC.NS.Scheduler.SCHEDULERService.exe uninstall"/>
<InstallExecuteSequence>
<Custom Action="RunSCHEDULERInstall" After="InstallFiles">NOT Installed</Custom>
<Custom Action="SetInstallLocationRootDirectory" After="CostFinalize" >Not Installed</Custom>
<Custom Action="RunSCHEDULERUninstall" After='InstallInitialize'>(NOT UPGRADINGPRODUCTCODE) AND (REMOVE="ALL")</Custom>
</InstallExecuteSequence>
<!-- The directory structure for installation -->
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="INSTALLLOCATION" Name="WindowsService">
<Directory Id="SCHEDULERIMPORTERFOLDER" Name="ABC.NS.Scheduler.SCHEDULERService" />
<Directory Id="LOGFOLDER" Name="Log"/>
</Directory>
</Directory>
<Feature Id="ProductFeature" Title="ABC.NS.Scheduler.Deployment.SCHEDULER" Level="1">
<ComponentGroupRef Id="SCHEDULERServiceComponents" />
</Feature>
</Product>
</Wix>
Any help will be appreciated. Thanks.

How can I set recovery-options of a service with WiX?

I have following .wxs-file:
<?xml version="1.0" encoding="UTF-8"?>
<?define ProductVersion="x.x.x.x" ?>
<?define UpgradeCode="{**MYGUID**}" ?>
<?define Manufacturer="My Company" ?>
<?define ProductName="My Product" ?>
<?define SkuName="MyProduct" ?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*"
Name="$(var.ProductName)"
Language="1033"
Version="$(var.ProductVersion)"
Manufacturer="$(var.Manufacturer)"
UpgradeCode="$(var.UpgradeCode)">
<Package InstallerVersion="301"
Compressed="yes"
InstallPrivileges="elevated"
InstallScope="perMachine"
Platform="x86" />
<Media Id="1"
Cabinet="$(var.SkuName).cab"
EmbedCab="yes" />
<Directory Id="TARGETDIR"
Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="ManufacturereDirectory"
Name="$(var.Manufacturer)">
<Directory Id="ProductDirectory"
Name="$(var.ProductName)" />
</Directory>
</Directory>
</Directory>
<ComponentGroup Id="MainComponentGroup">
<Component Directory="ProductDirectory">
<File Name="$(var.MyProject.TargetFileName)"
Source="$(var.MyProject.TargetPath)"
KeyPath="yes"
Vital="yes" />
<ServiceInstall Id="SeviceInstall"
Name="$(var.ProductName)"
DisplayName="$(var.ProductName)"
Type="ownProcess"
Interactive="no"
Start="auto"
Vital="yes"
ErrorControl="normal"
Account="LOCALSYSTEM">
</ServiceInstall>
<ServiceControl Id="ServiceControl_Start"
Name="$(var.ProductName)"
Start="install"
Wait="no" />
<ServiceControl Id="ServiceControl_Stop"
Name="$(var.ProductName)"
Stop="both"
Remove="uninstall"
Wait="yes" />
</Component>
</ComponentGroup>
<Feature Id="MainFeature"
Level="1">
<ComponentGroupRef Id="MainComponentGroup" />
</Feature>
<Upgrade Id="$(var.UpgradeCode)">
<UpgradeVersion Property="UPGRADEFOUND"
Minimum="0.0.0.1" IncludeMinimum="yes"
Maximum="$(var.ProductVersion)" IncludeMaximum="yes"
OnlyDetect="no"
IgnoreRemoveFailure="yes"
MigrateFeatures="yes"/>
</Upgrade>
<CustomAction Id="ServiceRestarter"
Directory="ProductDirectory"
ExeCommand=""[SystemFolder]sc.exe" failure "$(var.ProductName)" reset= 60 actions= restart/0"
Impersonate="no" />
<InstallExecuteSequence>
<InstallExecute Before="RemoveExistingProducts" />
<RemoveExistingProducts Before="InstallFinalize" />
<Custom Action="ServiceRestarter" After="InstallFinalize"><![CDATA[NOT Installed]]></Custom>
</InstallExecuteSequence>
</Product>
</Wix>
Before that, I've tried:
<CustomAction Id="ServiceRestarter"
Property="QtExecCmdLine"
Value='"[SystemFolder]sc.exe" failure "$(var.ProductName)" reset= 60 actions= restart/0' />
which apparently called sc.exe - but changed nothing ...
Before that I've tried:
<ServiceInstall Id="SeviceInstall"
Name="$(var.ProductName)"
DisplayName="$(var.ProductName)"
Type="ownProcess"
Interactive="no"
Start="auto"
Vital="yes"
ErrorControl="normal"
Account="LOCALSYSTEM">
<ServiceConfig Id="ServiceConfig"
DelayedAutoStart="yes"
OnInstall="yes"
OnReinstall="yes"
OnUninstall="no"
FailureActionsWhen="failedToStopOrReturnedError" />
<ServiceConfigFailureActions Id="ServiceRestarter"
OnInstall="yes"
OnReinstall="yes"
OnUninstall="no"
ResetPeriod="0">
<Failure Action="restartService" Delay="0" />
<Failure Action="restartService" Delay="0" />
<Failure Action="restartService" Delay="0" />
</ServiceConfigFailureActions>
</ServiceInstall>
which did not work, as the MsiServiceConfigFailureActions table does not work if using an installer < 5.0, and even if using InstallerVersion="500" the only thing I get is an error:
Serivce 'My Product' (My Product) could not be configured. This could
be a problem with the package or your permissions. Verify that you
have sufficient privileges to configure system services.
(and yes, ... I've tried InstallPrivilges="elevated" also - but ... the real issue is Action="restartService" according to this)
So ... using a CustomAction is the way to go (or not?).
I have following output of the log
MSI (s) (34:28) [13:56:46:914]: Note: 1: 1722 2: ServiceRestarter 3: C:\Program Files (x86)\My Company\My Product\ 4: "C:\Windows\SysWOW64\sc.exe" failure "My Product" reset= 60 actions= restart/0
MSI (s) (34:28) [13:56:46:914]: Note: 1: 2205 2: 3: Error
MSI (s) (34:28) [13:56:46:914]: Note: 1: 2228 2: 3: Error 4: SELECT Message FROM Error WHERE Error = 1722
MSI (c) (2C:0C) [13:56:46:914]: Font created. Charset: Req=0, Ret=0, Font: Req=MS Shell Dlg, Ret=MS Shell Dlg
Error 1722. There is a problem with this Windows Installer package. A program run as part of the setup did not finish as expected. Contact your support personnel or package vendor. Action ServiceRestarter, location: C:\Program Files (x86)\My Company\My Product\, command: "C:\Windows\SysWOW64\sc.exe" failure "My Product" reset= 60 actions= restart/0
MSI (s) (34:28) [13:56:48:849]: Note: 1: 2205 2: 3: Error
MSI (s) (34:28) [13:56:48:849]: Note: 1: 2228 2: 3: Error 4: SELECT Message FROM Error WHERE Error = 1709
MSI (s) (34:28) [13:56:48:849]: Product: My Product -- Error 1722. There is a problem with this Windows Installer package. A program run as part of the setup did not finish as expected. Contact your support personnel or package vendor. Action ServiceRestarter, location: C:\Program Files (x86)\My Company\My Product\, command: "C:\Windows\SysWOW64\sc.exe" failure "My Product" reset= 60 actions= restart/0
Action ended 13:56:48: ServiceRestarter. Return value 3.
Action ended 13:56:48: INSTALL. Return value 3.
Can anybody help me out?
edit
I've used the old ServiceConfig-extension:
<util:ServiceConfig xmlns:util="http://schemas.microsoft.com/wix/UtilExtension"
FirstFailureActionType="restart"
SecondFailureActionType="restart"
ThirdFailureActionType="restart"
ResetPeriodInDays="1"
RestartServiceDelayInSeconds="20" />
which gives me a following build-error:
error CNDL0200: The ServiceInstall element contains an unhandled
extension element 'util:ServiceConfig'. Please ensure that the
extension for elements in the
'http://schemas.microsoft.com/wix/UtilExtension' namespace has been
provided.
I know that I can resolve this error by using -ext WixUtilExtension via commandline - but I want to use Visual Studio for building ... So how can I adapt the build-command?
Only chance is to add a reference to WixUtilExtension.dll to my project.
I can see that you've only tried the ServiceConfig element, which came with MSI 5.0. However, there's another ServiceConfig element in UtilExtension, which has been there for a long time and it seems that the thread you mention in your question confirms that it works.
The util:ServiceConfig element contains 3 parameters you'd like to use: FirstFailureActionType, SecondFailureActionType and ThirdFailureActionType, all accepting the same enumeration of values - none, reboot, restart and runCommand.
Try it out and if it works, it is far better choice than a custom action.
For WIX V 4.0, building with VS2015, the following works:
1: Ensure that WixUtilExtension.dll assembly is referenced by WIX project.
2: Add http://wixtoolset.org/schemas/v4/wxs/util ns to root Wix element. Note that this is the correct NS for WIX 4.0 (NOT http://schemas.microsoft.com/wix/UtilExtension as for previous versions).
<Wix
xmlns="http://wixtoolset.org/schemas/v4/wxs"
xmlns:util="http://wixtoolset.org/schemas/v4/wxs/util"
>
3: Ensure that ServiceConfig element is prefixed with correct namespace reference.
<ServiceInstall
Id="MyService"
Type="ownProcess"
Name="MyService"
DisplayName="MyService"
Description="My Service"
Start="auto"
Account="[SERVICEACCOUNT]"
Password="[SERVICEPASSWORD]"
ErrorControl="normal"
>
<util:ServiceConfig
FirstFailureActionType='restart'
SecondFailureActionType='restart'
ThirdFailureActionType='restart'
RestartServiceDelayInSeconds='30'
ResetPeriodInDays='1'/>
</ServiceInstall>
In Visual Studio, to avoid using -ext in CLI you may do the following:
Of course, you add a resource: <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
then, in Solution Explorer -> References -> Add..
WixUtilExtension.dll
After that everything works like a charm.
(wix 3.10)
Of course, if you do use the second ServiceConfig from utils. Like <util:ServiceConfig blablabla